diff --git a/stechuhr-server.service b/stechuhr-server.service index d291875601649e2a632b8c6227f191ae7f0947a3..16764acc88f181cfb9f54ce07d172968453f90b0 100644 --- a/stechuhr-server.service +++ b/stechuhr-server.service @@ -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 diff --git a/stechuhr_server/config.py b/stechuhr_server/config.py index 84a335a68befae52927ddbd9a452c3c1a1583b08..27c3be35fd092be140c2037f84121c1ae285458e 100644 --- a/stechuhr_server/config.py +++ b/stechuhr_server/config.py @@ -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: