From 63670f52e89b8573620e25418ddf62bc8ab3674d Mon Sep 17 00:00:00 2001 From: Oscar Krause Date: Wed, 28 Dec 2022 07:03:41 +0100 Subject: [PATCH] postinst fixes --- DEBIAN/postinst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/DEBIAN/postinst b/DEBIAN/postinst index 83e6ccd..d1c43e4 100644 --- a/DEBIAN/postinst +++ b/DEBIAN/postinst @@ -1,7 +1,12 @@ #!/bin/bash +CONFIG_DIR=/etc/fastapi-dls + +echo "> Create config directory ..." +mkdir -p $CONFIG_DIR + echo "> Install service ..." -cat < /etc/systemd/system/fastapi-dls.service +cat </etc/systemd/system/fastapi-dls.service [Unit] Description=Service for fastapi-dls After=network.target @@ -11,7 +16,7 @@ User=www-data Group=www-data AmbientCapabilities=CAP_NET_BIND_SERVICE WorkingDirectory=/usr/share/fastapi-dls -EnvironmentFile=/etc/fastapi-dls/env +EnvironmentFile=$CONFIG_DIR/env ExecStart=uvicorn main:app \\ --env-file /etc/fastapi-dls/env \\ --host \$DLS_URL --port \$DLS_PORT \\ @@ -30,14 +35,9 @@ WantedBy=multi-user.target EOF -CONFIG_DIR=/etc/fastapi-dls - -echo "> Create config directory ..." -mkdir -p $CONFIG_DIR - echo "> Writing default config parameters ..." -touch $CONFIG_DIR/fastapi-dls/env -cat < $CONFIG_DIR/fastapi-dls/env +touch $CONFIG_DIR/env +cat <$CONFIG_DIR/env DLS_URL=127.0.0.1 DLS_PORT=443 LEASE_EXPIRE_DAYS=90