"""Functions for handling dev authentication overrides.""" from sound_recordings import config def get_dev_auth(): """If the environment is dev, and dev headers are defined, return them.""" if config.ENVIRONMENT == config.DEV_ENVIRONMENT and has_dev_auth(): return config.DEV_AUTH return None def get_profile_dev_auth(): """If the environment is dev, and dev headers are defined, return them.""" if config.ENVIRONMENT == config.DEV_ENVIRONMENT and has_profile_dev_auth(): return config.DEV_PROFILE_AUTH return None def has_dev_auth(): """Return true if any environment variables for DEV_AUTH are not None.""" return config.DEV_AUTH is not None and any( [v is not None for v in config.DEV_AUTH.values()] ) def has_profile_dev_auth(): """Check if any environment variables for DEV_PROFILE_AUTH are not None.""" return config.DEV_PROFILE_AUTH is not None and any( [v is not None for v in config.DEV_PROFILE_AUTH.values()] )