container env variables for db

This commit is contained in:
2024-01-28 22:33:42 +01:00
parent fb968853b5
commit 564a2c61df
3 changed files with 13 additions and 1 deletions

View File

@ -7,8 +7,17 @@ app = Flask(__name__)
def get_conf():
'''return settings in settings.yaml file'''
settings = dict()
with open(os.path.dirname(os.path.realpath(__file__))+"/settings.yaml", 'r') as conf_file:
settings = yaml.safe_load(conf_file)
settings["db"] = {
"host": os.environ.get('POSTGRES_HOST'),
"port": os.environ.get('POSTGRES_PORT'),
"database": os.environ.get('POSTGRES_DB'),
"user": os.environ.get('POSTGRES_USER'),
"password": os.environ.get('POSTGRES_PASSWORD')
}
return settings
@app.route('/init')