Example config
This commit is contained in:
parent
a51a89a968
commit
365fc9405d
17
config/config.py
Normal file
17
config/config.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Checkout the Variables bellow
|
||||||
|
# Special lines:
|
||||||
|
# # => Comented lines, they get ignored by python
|
||||||
|
# #- => Optional Configuration lines
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
|
||||||
|
## Database Variables
|
||||||
|
db = {}
|
||||||
|
#- db['root_pw'] = 'RootPassWord'
|
||||||
|
db['enabled'] = True
|
||||||
|
db['user'] = 'DBUser'
|
||||||
|
db['user_pw'] = 'DBUserPassWord'
|
||||||
|
db['db'] = 'Database Name'
|
||||||
|
#- db['data_path_mysql'] = '/var/lib/mysql'
|
||||||
|
#- db['data_path_mysql_backup'] = '/var/lib/mysql'
|
||||||
|
#- db['port'] = 3306
|
0
config/configfiles.py
Normal file
0
config/configfiles.py
Normal file
27
config/template.py
Executable file
27
config/template.py
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
from jinja2 import Environment, FileSystemLoader
|
||||||
|
import config
|
||||||
|
import os
|
||||||
|
|
||||||
|
# Static Variables
|
||||||
|
templates_directory = 'src/templates'
|
||||||
|
|
||||||
|
# Load Templates Directory
|
||||||
|
file_loader = FileSystemLoader(templates_directory)
|
||||||
|
env = Environment(loader=file_loader)
|
||||||
|
|
||||||
|
# Template everyfile
|
||||||
|
def template(filename, target_path):
|
||||||
|
# Load Template
|
||||||
|
template = env.get_template(filename)
|
||||||
|
# Render Output
|
||||||
|
content = template.render(db=config.db)
|
||||||
|
# Write Template to file
|
||||||
|
filename_without_ext = os.path.splitext(filename)[0]
|
||||||
|
cooked_file = target_path+filename_without_ext
|
||||||
|
file = open(cooked_file, 'w')
|
||||||
|
file.write(content)
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
# Render the templates:
|
||||||
|
## Create Docker-Compose
|
||||||
|
template("docker-compose.yml.j2", "./src/")
|
Loading…
Reference in New Issue
Block a user