status_page.utils package

Submodules

status_page.utils.crypto module

status_page.utils.crypto.generate_hash(password: str) → bytes

Salts and hashes a password to generate a hash for storage in a database :param password: The password to hash :return: The hash of the password

status_page.utils.crypto.verify_password(password: str, hashed: str)

Verifies that a password matches a given hash :param password: The password to verify :param hashed: The hash to verify the password against :return: True if the password matches, otherwise False

status_page.utils.env module

status_page.utils.env.load_secrets(secrets_file: str)

Loads a JSON file filled with configuration details and secrets into os.environ :param secrets_file: The file to load :return: None

status_page.utils.env.resolve_env_variable(env_key: str, _type: type = <class 'str'>, default: object = None) → object

Resolves an environment key. A non-existant environment key will lead to a KeyError unless the app is in testing mode, in which case database-related variables won’t cause a KeyError. KeyErrors can also be provided using the ‘default’ argument :param env_key: The environment key to resolve :param _type: The type of the environment variable :param default: An optional default value :return: The resolved environment variable.

None if the app is in testing mode and the variable is db-related

status_page.utils.initialize module

status_page.utils.initialize.initialize_app()

Initializes the App :return: None

status_page.utils.initialize.initialize_db(db_uri: str)

Initializes the SQLAlchemy database :param db_uri: The URI of the database to initialize :return: None

status_page.utils.initialize.initialize_login_manager()

Initializes the login manager :return: None

Module contents