flip_api.config =============== .. py:module:: flip_api.config Attributes ---------- .. autoapisummary:: flip_api.config._settings Classes ------- .. autoapisummary:: flip_api.config.Settings flip_api.config.DevSettings flip_api.config.ProdSettings Functions --------- .. autoapisummary:: flip_api.config.get_settings Module Contents --------------- .. py:class:: Settings Bases: :py:obj:`pydantic_settings.BaseSettings` Common settings shared across all environments (development and production). .. py:attribute:: ENV :type: Literal['development', 'production'] :value: 'development' .. py:attribute:: LOG_LEVEL :type: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] :value: 'INFO' .. py:attribute:: model_config .. py:attribute:: TRUST_API_KEY_HEADER :type: str .. py:attribute:: INTERNAL_SERVICE_KEY_HEADER :type: str .. py:attribute:: AWS_PROFILE :type: str | None :value: None .. py:attribute:: AWS_REGION :type: str .. py:attribute:: AWS_COGNITO_USER_POOL_ID :type: str .. py:attribute:: AWS_COGNITO_APP_CLIENT_ID :type: str .. py:attribute:: AWS_SECRET_NAME :type: str .. py:attribute:: AWS_SES_ADMIN_EMAIL_ADDRESS :type: pydantic.EmailStr .. py:attribute:: AWS_SES_SENDER_EMAIL_ADDRESS :type: pydantic.EmailStr .. py:attribute:: UPLOADED_MODEL_FILES_BUCKET :type: str .. py:attribute:: SCANNED_MODEL_FILES_BUCKET :type: str .. py:attribute:: UPLOADED_FEDERATED_DATA_BUCKET :type: str .. py:attribute:: FL_APP_BASE_BUCKET :type: str .. py:attribute:: FL_APP_DESTINATION_BUCKET :type: str .. py:attribute:: MAX_MODEL_FILE_BYTES :type: int :value: 104857600 .. py:attribute:: PRE_SIGNED_URL_EXPIRATION_SECONDS :type: int :value: 3600 .. py:attribute:: PROJECT_REIMPORT_RATE :type: int :value: 60 .. py:attribute:: MAX_REIMPORT_COUNT :type: int :value: 5 .. py:attribute:: SCHEDULE_RUN_JOBS_EXECUTION :type: bool :value: True .. py:attribute:: SCHEDULER_RUN_JOBS_RATE :type: int :value: 1 .. py:attribute:: SCHEDULER_KEEP_FL_API_SESSION_ALIVE_RATE :type: int :value: 2 .. py:attribute:: SCHEDULER_REIMPORT_IMAGING_PROJECT_STUDIES_RATE :type: int :value: 30 .. py:attribute:: DB_PORT :type: int .. py:attribute:: DB_HOST :type: str :value: 'localhost' .. py:attribute:: POSTGRES_USER :type: str .. py:attribute:: POSTGRES_DB :type: str .. py:attribute:: NET_ENDPOINTS :type: dict[str, str] .. py:attribute:: FL_KIT_SLOT_NAMES :type: list[str] :value: [] .. py:attribute:: FL_BACKEND :type: flip_api.domain.schemas.types.FLBackend .. py:attribute:: ENFORCE_MFA :type: bool :value: True .. py:method:: coerce_empty_env(v: str) -> str :classmethod: Treat empty-string ENV (e.g. from CI environment injection) as 'development'. .. py:method:: coerce_empty_mfa(v: str | bool | None) -> bool :classmethod: Treat empty-string or None ENFORCE_MFA as the default True. .. py:method:: coerce_log_level(v: object) -> object :classmethod: Treat empty-string or None LOG_LEVEL as the default INFO; uppercase string input. Non-string, non-empty input is returned unchanged so the downstream Literal validator rejects it loudly, instead of ``.upper()`` raising ``AttributeError`` mid-validation on e.g. ``Settings(LOG_LEVEL=10)``. .. py:method:: coerce_empty_max_model_file_bytes(v: object) -> object :classmethod: Treat empty-string MAX_MODEL_FILE_BYTES as the default 100 MiB. GitHub Actions environments inject empty-string env vars for every var that isn't explicitly set in the environment scope; Pydantic treats that as a real override and rejects it against ``int``. Same shape as ``coerce_empty_env`` / ``coerce_empty_mfa``. .. py:method:: coerce_empty_pre_signed_url_expiration(v: object) -> object :classmethod: Treat empty-string PRE_SIGNED_URL_EXPIRATION_SECONDS as the default 3600s. Same rationale as ``coerce_empty_max_model_file_bytes``. .. py:attribute:: HEARTBEAT_TIMEOUT_SECONDS :type: int :value: 30 .. py:attribute:: TASK_STALE_TIMEOUT_MINUTES :type: int :value: 30 .. py:attribute:: TASK_MAX_RETRIES :type: int :value: 3 .. py:attribute:: SCHEDULER_STALE_TASK_RECOVERY_RATE :type: int :value: 10 .. py:attribute:: MAX_TASK_RESULT_LENGTH :type: int :value: 10000000 .. py:attribute:: FLIP_API_URL :type: str :value: 'http://localhost:8080/api' .. py:attribute:: ADMIN_USER_PASSWORD :type: pydantic.SecretStr | None :value: None .. py:class:: DevSettings Bases: :py:obj:`Settings` Settings specific to local or development environment. .. py:attribute:: ENV :type: Literal['development'] :value: 'development' .. py:attribute:: POSTGRES_PASSWORD :type: str .. py:attribute:: AES_KEY_BASE64 :type: str .. py:attribute:: INTERNAL_SERVICE_KEY_HASH :type: str .. py:class:: ProdSettings Bases: :py:obj:`Settings` Settings specific to production environment. Production authenticates to Postgres via RDS Proxy with per-connection IAM tokens (see db/database.py), so there is no static DB password setting here. .. py:attribute:: ENV :type: Literal['production'] :value: 'production' .. py:data:: _settings .. py:function:: get_settings() -> DevSettings | ProdSettings Get the application settings. :returns: An instance of Settings containing configuration values. :rtype: DevSettings | ProdSettings