2018-11-15 04:09:57 +01:00
|
|
|
import os
|
|
|
|
|
2019-07-30 07:04:28 +02:00
|
|
|
from g import config_dir, templates_dir, data_dir, PG_UID, PG_GID
|
2019-08-01 10:02:08 +02:00
|
|
|
from utils.misc import prepare_dir
|
2018-11-15 04:09:57 +01:00
|
|
|
from utils.jinja import render_jinja
|
|
|
|
|
|
|
|
db_config_dir = os.path.join(config_dir, "db")
|
|
|
|
db_env_template_path = os.path.join(templates_dir, "db", "env.jinja")
|
|
|
|
db_conf_env = os.path.join(config_dir, "db", "env")
|
2019-07-30 07:04:28 +02:00
|
|
|
database_data_path = os.path.join(data_dir, 'database')
|
2018-11-15 04:09:57 +01:00
|
|
|
|
|
|
|
def prepare_db(config_dict):
|
2019-08-01 10:02:08 +02:00
|
|
|
prepare_dir(database_data_path, uid=PG_UID, gid=PG_GID)
|
|
|
|
prepare_dir(db_config_dir)
|
2018-11-15 04:09:57 +01:00
|
|
|
render_jinja(
|
|
|
|
db_env_template_path,
|
|
|
|
db_conf_env,
|
2019-05-10 04:44:05 +02:00
|
|
|
harbor_db_password=config_dict['harbor_db_password'])
|