diff --git a/README.md b/README.md index 4aa1912..fb54061 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,19 @@ All configuration is handled through environment variables. | Name | Default | Description | |---------------------------------|-------------------------------------------------------------------------|------------------------------------------------------------------------------------------| -| `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_CLIENT_ID` | `hmdooris` | OIDC client ID | -| `HMDOORIS_CLIENT_SECRET` | - | ODIC client secret for the confidential flow | +| `HMDOORIS_ALLOWED_IPS` | - | List of IP addresses in CIDR notation that are allowed to control the locks. | +| `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_CCU_CERTIFICATE_PATH` | - | File of a private certificate, or `false`. | +| `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_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_CCUJACK_URL` | `https://raspberrymatic:2122` | URL of the CCU Jack server | -| `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 | +| `HMDOORIS_URL` | `http://localhost:3000` | URL of the application, used to construct links to itself. | ### Required Group diff --git a/hmdooris/AppConfig.py b/hmdooris/AppConfig.py index 8d28c69..d790909 100644 --- a/hmdooris/AppConfig.py +++ b/hmdooris/AppConfig.py @@ -19,6 +19,7 @@ class AppConfig: self.staticpath = path.join(self.basepath, "static") self.templatepath = path.join(self.basepath, "templates") 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', 'http://localhost:8080/realms/testing/.well-known/openid-configuration') self.client_id = getenv('HMDOORIS_CLIENT_ID', 'hmdooris') @@ -56,5 +57,4 @@ class AppConfig: self.oidc = { 'client_id': self.client_id, - } diff --git a/hmdooris/__main__.py b/hmdooris/__main__.py index 7b32be3..0943206 100644 --- a/hmdooris/__main__.py +++ b/hmdooris/__main__.py @@ -89,4 +89,4 @@ def post_api_lock(id): return ccujack.lock_unlock(id, request.json["locking"]) 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)