main#
- class acore_server_config.config.define.main.EnvEnum(value)[source]#
In this project, we have three environment:
- sbx: represent the developer’s local laptop, and the sandbox environment
the change you made on your local laptop can be applied to sandbox.
- tst: a long living integration test environment. before releasing to
production, the app has to be deployed to test environment for QA.
prd: the production environment. can only be deployed from release branch.
- class acore_server_config.config.define.main.Env(servers: Dict[str, acore_server_config.config.define.server.Server] = <factory>, project_name: Optional[str] = None, env_name: Optional[str] = None)[source]#
- class acore_server_config.config.define.main.Config(data: dict, secret_data: dict, Env: Type[T_BASE_ENV], EnvEnum: Type[BaseEnvEnum], version: str)[source]#
- classmethod get_current_env() str[source]#
An abstract method that can figure out what is the environment this config should deal with. For example, you can define the git feature branch will become the dev env; the master branch will become the int env; the release branch will become prod env;
Example:
class Config(BaseConfig): ... @classmethod def get_current_env(cls) -> str: if "CI" in os.environ: return EnvEnum.test.value elif "AWS_LAMBDA_FUNCTION_NAME" in os.environ: return EnvEnum.prod.value else: return EnvEnum.dev.value