Allow configuration of listen IP and port
All checks were successful
docker-image / docker (push) Successful in 1m25s

This commit is contained in:
Stefan Bethke 2025-05-29 16:43:11 +02:00
commit ee8e6b3523
3 changed files with 13 additions and 12 deletions

View file

@ -6,18 +6,19 @@ All configuration is handled through environment variables.
| Name | Default | Description | | Name | Default | Description |
|---------------------------------|-------------------------------------------------------------------------|------------------------------------------------------------------------------------------| |---------------------------------|-------------------------------------------------------------------------|------------------------------------------------------------------------------------------|
| `HMDOORIS_ALLOWED_IPS` | - | List of IP addresses in CIDR notation that are allowed to control the locks | | `HMDOORIS_ALLOWED_IPS` | - | List of IP addresses in CIDR notation that are allowed to control the locks. |
| `HMDOORIS_URL` | `http://localhost:3000` | URL of the application, used to construct links to itself | | `HMDOORIS_DISCOVERY_URL` | `http://localhost:8080/realms/testing/.well-known/openid-configuration` | OIDC configuration discovery URL. |
| `HMDOORIS_DISCOVERY_URL` | `http://localhost:8080/realms/testing/.well-known/openid-configuration` | OIDC configuration discovery URL | | `HMDOORIS_CCUJACK_URL` | `https://raspberrymatic:2122` | URL of the CCU Jack server. |
| `HMDOORIS_CLIENT_ID` | `hmdooris` | OIDC client ID | | `HMDOORIS_CCU_CERTIFICATE_PATH` | - | File of a private certificate, or `false`. |
| `HMDOORIS_CLIENT_SECRET` | - | ODIC client secret for the confidential flow | | `HMDOORIS_CCUJACK_USERNAME` | - | Username in CCU Jack. |
| `HMDOORIS_CCUJACK_PASSWORD` | - | Password in CCU Jack. |
| `HMDOORIS_CLIENT_ID` | `hmdooris` | OIDC client ID. |
| `HMDOORIS_CLIENT_SECRET` | - | ODIC client secret for the confidential flow. |
| `HMDOORIS_LISTEN` | `127.0.0.1:3000` | Which IP and port to listen on. |
| `IDINVITE_OIDC_SCOPE` | `["openid", "email", "profile"]` | JSON list of OIDC scopes to request. The OIDC IDP will need to send the group attribute. | | `IDINVITE_OIDC_SCOPE` | `["openid", "email", "profile"]` | JSON list of OIDC scopes to request. The OIDC IDP will need to send the group attribute. |
| `IDINVITE_OIDC_USER_ATTR` | `email` | The attribute to use as the user ID | | `IDINVITE_OIDC_USER_ATTR` | `email` | The attribute to use as the user ID. |
| `HMDOORIS_REQUIRES_GROUP` | - | Set to require users to be a member of this groups. | | `HMDOORIS_REQUIRES_GROUP` | - | Set to require users to be a member of this groups. |
| `HMDOORIS_CCUJACK_URL` | `https://raspberrymatic:2122` | URL of the CCU Jack server | | `HMDOORIS_URL` | `http://localhost:3000` | URL of the application, used to construct links to itself. |
| `HMDOORIS_CCU_CERTIFICATE_PATH` | - | File of a private certificate, or `false` |
| `HMDOORIS_CCUJACK_USERNAME` | - | Username in CCU Jack |
| `HMDOORIS_CCUJACK_PASSWORD` | - | Password in CCU Jack |
### Required Group ### Required Group

View file

@ -19,6 +19,7 @@ class AppConfig:
self.staticpath = path.join(self.basepath, "static") self.staticpath = path.join(self.basepath, "static")
self.templatepath = path.join(self.basepath, "templates") self.templatepath = path.join(self.basepath, "templates")
self.url = getenv('HMDOORIS_URL', 'http://localhost:3000') self.url = getenv('HMDOORIS_URL', 'http://localhost:3000')
(self.listen_host, self.listen_port) = getenv('HMDOORIS_LISTEN', '127.0.0.1:3000').split(':')
self.discovery_url = getenv('HMDOORIS_DISCOVERY_URL', self.discovery_url = getenv('HMDOORIS_DISCOVERY_URL',
'http://localhost:8080/realms/testing/.well-known/openid-configuration') 'http://localhost:8080/realms/testing/.well-known/openid-configuration')
self.client_id = getenv('HMDOORIS_CLIENT_ID', 'hmdooris') self.client_id = getenv('HMDOORIS_CLIENT_ID', 'hmdooris')
@ -56,5 +57,4 @@ class AppConfig:
self.oidc = { self.oidc = {
'client_id': self.client_id, 'client_id': self.client_id,
} }

View file

@ -89,4 +89,4 @@ def post_api_lock(id):
return ccujack.lock_unlock(id, request.json["locking"]) return ccujack.lock_unlock(id, request.json["locking"])
if __name__ == '__main__': if __name__ == '__main__':
app.run(host='localhost', port=3000, server=GeventWebSocketServer, debug=config.debug, quiet=not config.debug) app.run(host=config.listen_host, port=config.listen_port, server=GeventWebSocketServer, debug=config.debug, quiet=not config.debug)