Skip to content
Snippets Groups Projects
Commit 4a275cad authored by David Huss's avatar David Huss :speech_balloon:
Browse files

Allow ENV to set config dir

parent fbd37f41
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,8 @@ Before=nginx.service
[Service]
Type=simple
User=wwwrun
Environment="STECHUHR-SERVER_CONFIG_PATH=/etc/stechuhr-server/config.toml"
WorkingDirectory=/srv/stechuhr-server
ExecStart=/srv/stechuhr-server/env/bin/gunicorn stechuhr_server.server:app
Restart=always
RestartSec=30
......@@ -13,7 +15,6 @@ PrivateTmp=yes
ProtectSystem=full
NoNewPrivileges=yes
AmbientCapabilities=CAP_NET_BIND_SERVICE
WorkingDirectory=/srv/stechuhr-server
[Install]
WantedBy=multi-user.target
......
......@@ -90,6 +90,10 @@ def initialize_config(application_name: str, default_config: str, app) -> dict:
exit(1)
app.logger.info("Read config from: {}".format(config_path))
# Log info about environment variable if not set
if os.environ.get(config_path_environment_variable) is None:
app.logger.info("Override config path by setting the Environment variable {}=".format(config_path_environment_variable))
return config
def config_has_missing_keys(config, default_config, default_strconfig, app) -> bool:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment