app.core package

Submodules

app.core.config module

class app.core.config.Settings(_env_file: str | PathLike | list[str | PathLike] | tuple[str | PathLike, ...] | None = '<object object>', _env_file_encoding: str | None = None, _env_nested_delimiter: str | None = None, _secrets_dir: str | PathLike | None = None, *, app_name: str = 'Flux RESTFul API', api_version: str = 'v1', has_gpus: bool = False, flux_nodes: int = 1, require_auth: bool = False, db_file: str = 'sqlite:///./flux-restful.db', flux_user: str = None, flux_token: str = None, secret_key: str = 'avqKkj7UOVHRz8bQcQshmxDcFnpSCkUn', access_token_expires_minutes: int = 600, option_flags: dict = {}, known_launchers: list = ['nextflow', 'snakemake'])[source]

Bases: BaseSettings

Basic settings and defaults for the Flux RESTFul API

access_token_expires_minutes : int
api_version : str
app_name : str
db_file : str
flux_nodes : int
flux_token : str
flux_user : str
has_gpus : bool
known_launchers : list
option_flags : dict
require_auth : bool
secret_key : str
app.core.config.generate_secret_key(length=32)[source]

Generate a secret key to encrypt, if one not provided.

app.core.config.get_bool_envar(key, default=False)[source]

Get a boolean from the environment, meaning the value is set.

app.core.config.get_int_envar(key, default=None)[source]

Get (and parse) an integer environment variable

app.core.config.get_option_flags(key, prefix='-o')[source]

Wrapper around parse_option_flags to get from environment.

The function can then be shared to parse flags from the UI in the same way.

app.core.config.parse_option_flags(flags, prefix='-o')[source]

Parse key value pairs (optionally with a prefix) from the environment.

app.core.logging module

app.core.logging.init_loggers(logger_name: str = 'errors-analysis')[source]

app.core.security module

app.core.security.create_access_token(subject: str | Any, expires_delta: timedelta | None = None, secret_key=None) str[source]

Create a jwt access token.

We either use the user’s secret key (which is hashed) or fall back to the server set secret key.

app.core.security.get_password_hash(password: str) str[source]

Note we aren’t providing a salt here, so the same password can generate different.

app.core.security.verify_password(plain_password: str, hashed_password: str) bool[source]

Verify the password

Module contents


Last update: Mar 11, 2023