hmdooris/hmdooris/AppConfig.py
2025-05-21 14:44:29 +02:00

21 lines
966 B
Python

import json
from os import getenv, path
class AppConfig:
def __init__(self):
"""
Gets the config from environment variables
"""
self.basepath = path.dirname(__file__)
self.app_email_base_uri = getenv('APP_EMAIL_BASE_URI', 'http://localhost:3000')
self.app_keycloak_base_uri = getenv('APP_KEYCLOAK_BASE_URI', 'http://localhost:3000')
self.url = getenv('IDINVITE_URL', 'http://localhost:3000')
self.discovery_url = getenv('HMDOORIS_DISCOVERY_URL',
'http://localhost:8080/realms/testing/.well-known/openid-configuration')
self.client_id = getenv('HMDOORIS_CLIENT_ID', 'hmdooris')
self.client_secret = getenv('HMDOORIS_CLIENT_SECRET')
self.requires_group = getenv('HMDOORIS_REQUIRES_GROUP', None)
if self.client_secret is None or self.client_secret == '':
raise ValueError('You need to provide HMDOORIS_CLIENT_SECRET')