Compare commits
2 commits
cb570a7663
...
5a550e4594
| Author | SHA1 | Date | |
|---|---|---|---|
|
5a550e4594 |
|||
|
f72f830b36 |
4 changed files with 41 additions and 3 deletions
1
.dev.env
1
.dev.env
|
|
@ -2,3 +2,4 @@ DOORIS_OPENID_ISSUER=https://id.hamburg.ccc.de/realms/test/
|
|||
DOORIS_OPENID_CLIENT_ID=dooris
|
||||
DOORIS_OPENID_CLIENT_SECRET=dp9HhnvUhAtKm3pRnxfGA7q8Nwrd1td8
|
||||
DOORIS_BASE_URL=http://localhost:8000
|
||||
DOORIS_CCUJACK_USER=dooris
|
||||
|
|
|
|||
19
README.md
19
README.md
|
|
@ -10,6 +10,25 @@ Project structure:
|
|||
└── app # Web UI
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
The final application can be configured either via CLI arguments or via environment variables.
|
||||
If both are given, the CLI flag takes precedence.
|
||||
|
||||
THe following table lists all available configuration parameters:
|
||||
|
||||
| CLI Flag | Environment Variable | Required? | Default Value |
|
||||
| -------- | -------------------- | :-------: | ------------- |
|
||||
| `--openid-issuer` | `DOORIS_OPENID_ISSUER` | Yes | *None* |
|
||||
| `--openid-scope` | `DOORIS_OPENID_SCOPE` | No | `openid profile` |
|
||||
| `--openid-client-id` | `DOORIS_OPENID_CLIENT_ID` | Yes | *None* |
|
||||
| `--openid-client-secret` | `DOORIS_OPENID_CLIENT_SECRET` | Yes | *None* |
|
||||
| `--base-url` | `DOORIS_BASE_URL` | Yes | *None* |
|
||||
| `--serve-static` | `DOORIS_SERVE_STATIC` | No | *None* |
|
||||
| `--ccujack-url` | `DOORIS_CCUJACK_URL` | No | `https://hmdooris-ccu.ccchh.net:2122` |
|
||||
| `--ccujack-user` | `DOORIS_CCUJACK_USER` | Yes | *None* |
|
||||
| `--ccujack-password` | `DOORIS_CCUJACK_PASSWORD` | Yes | *None* |
|
||||
|
||||
## API Development
|
||||
|
||||
Most things should automatically be set up with the included [direnv script](./.envrc.dist) but if you don't use that, take the following steps:
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ def main():
|
|||
)
|
||||
argp.add_argument(
|
||||
"--openid-scope",
|
||||
default=os.environ.get("DOORIS_OPENID_SCOPE", "openid profile ccchh-roles"),
|
||||
default=os.environ.get("DOORIS_OPENID_SCOPE", "openid profile"),
|
||||
help="The Keycloak OpenID isser to use for authentication",
|
||||
)
|
||||
argp.add_argument(
|
||||
|
|
@ -46,6 +46,24 @@ def main():
|
|||
default=os.environ.get("DOORIS_SERVE_STATIC", None),
|
||||
help="In addition to the API functionality, serve static files from this path",
|
||||
)
|
||||
argp.add_argument(
|
||||
"--ccujack-url",
|
||||
required=False,
|
||||
default=os.environ.get("DOORIS_CCUJACK_URL", "https://hmdooris-ccu.ccchh.net:2122"),
|
||||
help="The URL under which a CCUJACK instance is hosted that actually operates the locks",
|
||||
)
|
||||
argp.add_argument(
|
||||
"--ccujack-user",
|
||||
required="DOORIS_CCUJACK_USER" not in os.environ,
|
||||
default=os.environ.get("DOORIS_CCUJACK_USER", None),
|
||||
help="The username used to authenticate against the CCUJACK",
|
||||
)
|
||||
argp.add_argument(
|
||||
"--ccujack-password",
|
||||
required="DOORIS_CCUJACK_PASSWORD" not in os.environ,
|
||||
default=os.environ.get("DOORIS_CCUJACK_PASSWORD", None),
|
||||
help="The password used to authenticate against the CCUJACK"
|
||||
)
|
||||
args = argp.parse_args()
|
||||
|
||||
app_config.set(args)
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ async def lifespan(app: FastAPI):
|
|||
)
|
||||
|
||||
app.extra["ccujack"] = CCUJackClient(
|
||||
"https://hmdooris-ccu.ccchh.net:2122",
|
||||
auth=BasicAuth("dooris", os.environ["HMDOORIS_PW"]),
|
||||
base_uri=app_cfg.ccujack_url,
|
||||
auth=BasicAuth(app_cfg.ccujack_user, app_cfg.ccujack_password)
|
||||
)
|
||||
await app.extra["ccujack"].find_locks()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue