properly detect if running via systemd

This commit is contained in:
Izalia Mae 2024-03-27 11:48:05 -04:00
parent 6112734b2f
commit 938d3f419e
2 changed files with 2 additions and 1 deletions

View file

@ -4,6 +4,7 @@ Description=ActivityPub Relay
[Service]
WorkingDirectory=/home/relay/relay
ExecStart=/usr/bin/python3 -m relay run
Environment="IS_SYSTEMD=1"
[Install]
WantedBy=multi-user.target

View file

@ -87,7 +87,7 @@ handlers: list[Any] = [logging.StreamHandler()]
if env_log_file:
handlers.append(logging.FileHandler(env_log_file))
if os.environ.get('INVOCATION_ID'):
if os.environ.get('IS_SYSTEMD'):
logging_format = '%(levelname)s: %(message)s'
else: