From 8d93c92de4fcb0a06202afbcc254079d8fcf1708 Mon Sep 17 00:00:00 2001 From: Oscar Krause Date: Tue, 20 Dec 2022 15:05:50 +0100 Subject: [PATCH] README.md - added configuration variables & implemented support for 'LEASE_EXPIRE_DAYS' --- README.md | 8 ++++++++ app/main.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ed2697b..8b58281 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,14 @@ openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout $WORKING_DIR/webse docker run -e DLS_URL=`hostname -i` -e DLS_PORT=443 -p 443:443 -v $WORKING_DIR:/app/cert collinwebdesigns/fastapi-dls:latest ``` +# Configuration + +| Variable | Default | Usage | +|---------------------|-------------|---------------------------------------------------------------------------| +| `DLS_URL` | `localhost` | Used in client-token to tell guest driver where dls instance is reachable | +| `DLS_PORT` | `443` | Used in client-token to tell guest driver where dls instance is reachable | +| `LEASE_EXPIRE_DAYS` | `90` | Lease time in days | + # Installation **The token file has to be copied! It's not enough to C&P file contents, because there can be special characters.** diff --git a/app/main.py b/app/main.py index 40d44a8..3e72d0d 100644 --- a/app/main.py +++ b/app/main.py @@ -31,7 +31,7 @@ def load_key(filename) -> RsaKey: app, db = FastAPI(), dataset.connect('sqlite:///db.sqlite') -LEASE_EXPIRE_DELTA = relativedelta(minutes=15) # days=90 +LEASE_EXPIRE_DELTA = relativedelta(days=int(getenv('LEASE_EXPIRE_DAYS', 90))) DLS_URL = str(getenv('DLS_URL', 'localhost')) DLS_PORT = int(getenv('DLS_PORT', '443'))