edq.config.settings
1import typing 2 3import edq.config.app 4import edq.config.common 5import edq.config.constants 6import edq.config.source 7import edq.util.serial 8 9def get_application_config_class() -> typing.Type[edq.config.app.BaseApplicationConfig]: 10 """ Get the application config class. """ 11 12 return typing.cast(typing.Type[edq.config.app.BaseApplicationConfig], edq.config.common._application_config_class) 13 14def set_application_config_class(config_class: typing.Union[typing.Type[edq.config.app.BaseApplicationConfig], None] = None) -> None: 15 """ Set the application config class. """ 16 17 if (config_class is None): 18 config_class = edq.config.common._DEFAULT_APPLICATION_CONFIG_CLASS # type: ignore[assignment] 19 20 edq.config.common._application_config_class = config_class # type: ignore[assignment] 21 22def get_config_filename() -> str: 23 """ Get the config filename. """ 24 25 return edq.config.common._config_filename 26 27def set_config_filename(filename: typing.Union[str, None] = None) -> None: 28 """ Set the config filename. """ 29 30 if (filename is None): 31 filename = edq.config.common._DEFAULT_CONFIG_FILENAME 32 33 edq.config.common._config_filename = filename 34 35def get_default_encryption_key() -> str: 36 """ Get the default encryption key. """ 37 38 return edq.config.common._default_encryption_key 39 40def set_default_encryption_key(encryption_key: typing.Union[str, None] = None) -> None: 41 """ Set the default encryption key. """ 42 43 if (encryption_key is None): 44 encryption_key = edq.config.common._DEFAULT_DEFAULT_ENCRYPTION_KEY 45 46 edq.config.common._default_encryption_key = encryption_key 47 48def get_env_prefix() -> str: 49 """ Get the environmental variable prefix. """ 50 51 return edq.config.common._env_prefix 52 53def set_env_prefix(prefix: typing.Union[str, None] = None) -> None: 54 """ Set the environmental variable prefix. """ 55 56 if (prefix is None): 57 prefix = edq.config.common._DEFAULT_ENV_PREFIX 58 59 edq.config.common._env_prefix = prefix 60 61def get_global_dir() -> str: 62 """ Get the global config dir. """ 63 64 return edq.config.common._global_dir 65 66def set_global_dir(global_dir: typing.Union[str, None] = None) -> None: 67 """ Set the global config dir. """ 68 69 if (global_dir is None): 70 global_dir = edq.config.common._DEFAULT_GLOBAL_DIR 71 72 edq.config.common._global_dir = global_dir 73 74def get_load_order() -> typing.List[edq.config.source.ConfigSourceSpec]: 75 """ Get the order to load config sources. """ 76 77 return typing.cast(typing.List[edq.config.source.ConfigSourceSpec], edq.config.common._load_order) 78 79def set_load_order(load_order: typing.Union[typing.List[edq.config.source.ConfigSourceSpec], None]) -> None: 80 """ Set the order to load config sources. """ 81 82 if (load_order is None): 83 load_order = typing.cast(typing.List[edq.config.source.ConfigSourceSpec], edq.config.common._DEFAULT_LOAD_ORDER.copy()) 84 85 edq.config.common._load_order = load_order # type: ignore[assignment]
10def get_application_config_class() -> typing.Type[edq.config.app.BaseApplicationConfig]: 11 """ Get the application config class. """ 12 13 return typing.cast(typing.Type[edq.config.app.BaseApplicationConfig], edq.config.common._application_config_class)
Get the application config class.
def
set_application_config_class( config_class: Optional[Type[edq.config.app.BaseApplicationConfig]] = None) -> None:
15def set_application_config_class(config_class: typing.Union[typing.Type[edq.config.app.BaseApplicationConfig], None] = None) -> None: 16 """ Set the application config class. """ 17 18 if (config_class is None): 19 config_class = edq.config.common._DEFAULT_APPLICATION_CONFIG_CLASS # type: ignore[assignment] 20 21 edq.config.common._application_config_class = config_class # type: ignore[assignment]
Set the application config class.
def
get_config_filename() -> str:
23def get_config_filename() -> str: 24 """ Get the config filename. """ 25 26 return edq.config.common._config_filename
Get the config filename.
def
set_config_filename(filename: Optional[str] = None) -> None:
28def set_config_filename(filename: typing.Union[str, None] = None) -> None: 29 """ Set the config filename. """ 30 31 if (filename is None): 32 filename = edq.config.common._DEFAULT_CONFIG_FILENAME 33 34 edq.config.common._config_filename = filename
Set the config filename.
def
get_default_encryption_key() -> str:
36def get_default_encryption_key() -> str: 37 """ Get the default encryption key. """ 38 39 return edq.config.common._default_encryption_key
Get the default encryption key.
def
set_default_encryption_key(encryption_key: Optional[str] = None) -> None:
41def set_default_encryption_key(encryption_key: typing.Union[str, None] = None) -> None: 42 """ Set the default encryption key. """ 43 44 if (encryption_key is None): 45 encryption_key = edq.config.common._DEFAULT_DEFAULT_ENCRYPTION_KEY 46 47 edq.config.common._default_encryption_key = encryption_key
Set the default encryption key.
def
get_env_prefix() -> str:
49def get_env_prefix() -> str: 50 """ Get the environmental variable prefix. """ 51 52 return edq.config.common._env_prefix
Get the environmental variable prefix.
def
set_env_prefix(prefix: Optional[str] = None) -> None:
54def set_env_prefix(prefix: typing.Union[str, None] = None) -> None: 55 """ Set the environmental variable prefix. """ 56 57 if (prefix is None): 58 prefix = edq.config.common._DEFAULT_ENV_PREFIX 59 60 edq.config.common._env_prefix = prefix
Set the environmental variable prefix.
def
get_global_dir() -> str:
62def get_global_dir() -> str: 63 """ Get the global config dir. """ 64 65 return edq.config.common._global_dir
Get the global config dir.
def
set_global_dir(global_dir: Optional[str] = None) -> None:
67def set_global_dir(global_dir: typing.Union[str, None] = None) -> None: 68 """ Set the global config dir. """ 69 70 if (global_dir is None): 71 global_dir = edq.config.common._DEFAULT_GLOBAL_DIR 72 73 edq.config.common._global_dir = global_dir
Set the global config dir.
75def get_load_order() -> typing.List[edq.config.source.ConfigSourceSpec]: 76 """ Get the order to load config sources. """ 77 78 return typing.cast(typing.List[edq.config.source.ConfigSourceSpec], edq.config.common._load_order)
Get the order to load config sources.
80def set_load_order(load_order: typing.Union[typing.List[edq.config.source.ConfigSourceSpec], None]) -> None: 81 """ Set the order to load config sources. """ 82 83 if (load_order is None): 84 load_order = typing.cast(typing.List[edq.config.source.ConfigSourceSpec], edq.config.common._DEFAULT_LOAD_ORDER.copy()) 85 86 edq.config.common._load_order = load_order # type: ignore[assignment]
Set the order to load config sources.