src.config.config
Configuration management using Ports/Adapters architecture.
1"""Configuration management using Ports/Adapters architecture.""" 2 3from collections.abc import Mapping 4from os import environ 5 6from src.config.config_port import ConfigRepoPort 7 8 9class EnvConfigRepo(ConfigRepoPort): 10 """Adapter: Configuration repository using environment variables.""" 11 12 server_host: str 13 server_port: int 14 ssi_agent_url: str 15 ssi_agent_nonce_endpoint: str 16 ssi_agent_credential_endpoint: str 17 public_url: str 18 debug: bool 19 postgresql_connection_string: str 20 21 def __init__(self, env: Mapping[str, str] = environ): 22 """Initialize with optional environment mapping. 23 24 Args: 25 env: Environment variable mapping. Defaults to os.environ. 26 """ 27 self.server_host = env["SERVER_HOST"] 28 self.server_port = int(env["SERVER_PORT"]) 29 self.ssi_agent_url = env["SSI_AGENT_URL"] 30 self.ssi_agent_nonce_endpoint = env["SSI_AGENT_NONCE_ENDPOINT"] 31 self.ssi_agent_credential_endpoint = env["SSI_AGENT_CREDENTIAL_ENDPOINT"] 32 self.public_url = env["PUBLIC_URL"] 33 self.debug = False 34 self.postgresql_connection_string = env["POSTGRES_CONNECTION_STRING"]
10class EnvConfigRepo(ConfigRepoPort): 11 """Adapter: Configuration repository using environment variables.""" 12 13 server_host: str 14 server_port: int 15 ssi_agent_url: str 16 ssi_agent_nonce_endpoint: str 17 ssi_agent_credential_endpoint: str 18 public_url: str 19 debug: bool 20 postgresql_connection_string: str 21 22 def __init__(self, env: Mapping[str, str] = environ): 23 """Initialize with optional environment mapping. 24 25 Args: 26 env: Environment variable mapping. Defaults to os.environ. 27 """ 28 self.server_host = env["SERVER_HOST"] 29 self.server_port = int(env["SERVER_PORT"]) 30 self.ssi_agent_url = env["SSI_AGENT_URL"] 31 self.ssi_agent_nonce_endpoint = env["SSI_AGENT_NONCE_ENDPOINT"] 32 self.ssi_agent_credential_endpoint = env["SSI_AGENT_CREDENTIAL_ENDPOINT"] 33 self.public_url = env["PUBLIC_URL"] 34 self.debug = False 35 self.postgresql_connection_string = env["POSTGRES_CONNECTION_STRING"]
Adapter: Configuration repository using environment variables.
EnvConfigRepo(env: Mapping[str, str] = os.environ)
22 def __init__(self, env: Mapping[str, str] = environ): 23 """Initialize with optional environment mapping. 24 25 Args: 26 env: Environment variable mapping. Defaults to os.environ. 27 """ 28 self.server_host = env["SERVER_HOST"] 29 self.server_port = int(env["SERVER_PORT"]) 30 self.ssi_agent_url = env["SSI_AGENT_URL"] 31 self.ssi_agent_nonce_endpoint = env["SSI_AGENT_NONCE_ENDPOINT"] 32 self.ssi_agent_credential_endpoint = env["SSI_AGENT_CREDENTIAL_ENDPOINT"] 33 self.public_url = env["PUBLIC_URL"] 34 self.debug = False 35 self.postgresql_connection_string = env["POSTGRES_CONNECTION_STRING"]
Initialize with optional environment mapping.
Args: env: Environment variable mapping. Defaults to os.environ.