Skip to content
Snippets Groups Projects
Verified Commit 564bad89 authored by Stefan Hynek's avatar Stefan Hynek :drooling_face:
Browse files

feat(config): add properties for host and nav_address

parent d03fd31f
No related branches found
No related tags found
No related merge requests found
......@@ -8,16 +8,20 @@ _logger = logging.getLogger(__name__)
def lookup_env_name(internal_name: str) -> str:
mapping = {
"_auth_wsdl": "tg_auth_wsdl",
"_auth_address": "tg_auth_address",
"_auth_wsdl" : "tg_auth_wsdl",
"_auth_address" : "tg_auth_address",
"_nav_address" : "tg_nav_address",
"_host" : "tg_host",
}
return mapping[internal_name]
# TODO check for trailing "/", add if missing!
class TextgridConfig:
def __init__(self):
self._auth_wsdl = os.getenv(lookup_env_name("_auth_wsdl"))
self._auth_address = os.getenv(lookup_env_name("_auth_address"))
self._nav_address = os.getenv(lookup_env_name("_nav_address"))
self._host = os.getenv(lookup_env_name("_host"))
@property
def auth_wsdl(self):
......@@ -31,3 +35,15 @@ class TextgridConfig:
if self._auth_address:
return self._auth_address
raise EnvNotSetError(lookup_env_name("_auth_address"))
@property
def nav_address(self):
if self._nav_address:
return self._nav_address
raise EnvNotSetError(lookup_env_name("_nav_address"))
@property
def host(self):
if self._host:
return self._host
raise EnvNotSetError(lookup_env_name("_host"))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment