es_sfgtools.config.env_config module
This module manages environment-specific configurations.
It defines a class Environment that detects the current working environment (e.g., LOCAL or GEOLAB) and loads relevant settings from environment variables.
- class es_sfgtools.config.env_config.Environment
Bases:
objectA class to manage and provide access to environment-specific settings.
This class should not be instantiated. It provides its functionality through class methods.
- classmethod load_aws_credentials() tuple[str | None, str | None, str | None, str | None]
Loads AWS credentials from environment variables or profile.
This method first checks for AWS_PROFILE. If set, it returns the profile name and None for the explicit credentials (letting the AWS SDK handle profile resolution). Otherwise, it checks for AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN environment variables.
- Returns:
- (aws_access_key, aws_secret_key, aws_session_token, aws_profile)
If profile is set, the first three will be None. If explicit credentials are set, aws_profile will be None.
- Return type:
tuple
- Raises:
Warning – If neither profile nor explicit credentials are fully set.
- classmethod load_working_environment() None
Loads configuration from environment variables.
This method checks for WORKING_ENVIRONMENT, S3_SYNC_BUCKET, and MAIN_DIRECTORY_GEOLAB and sets the class-level attributes accordingly.
- Raises:
ValueError – If the environment is set to GEOLAB but the required directory is not specified, or if an unknown environment is specified.
- classmethod main_directory_GEOLAB() str | None
Returns the main directory for the GEOLAB environment, if configured.
- classmethod s3_sync_bucket() str | None
Returns the S3 sync bucket name, if configured.
- classmethod working_environment() WorkingEnvironment
Returns the current working environment.