apifrom.configο
Configuration module for APIFromAnything.
This module provides configuration classes and utilities for different environments.
Overviewο
Classes
DevelopmentConfigEnvironmentProductionConfigStagingConfigTestingConfig
Functions
Classesο
Base configuration class with common settings.
- DevelopmentConfig:bases: BaseConfig
Development environment configuration.
- Environment:bases: enum.Enum
Environment types for the application.
- ProductionConfig:bases: BaseConfig
Production environment configuration.
- StagingConfig:bases: BaseConfig
Staging environment configuration.
- TestingConfig:bases: BaseConfig
Testing environment configuration.
Functionsο
Configure logging for the application.
- apifrom.config.configure_logging_dict(log_level='INFO', log_format='structured', log_file=None, max_bytes=10485760, backup_count=5)[source]ο
Create a logging configuration dictionary.
- param log_level:
The logging level.
- param log_format:
The log format (βstructuredβ for JSON, βsimpleβ for text).
- param log_file:
The path to the log file. If None, logs will be sent to stdout.
- param max_bytes:
The maximum size of the log file before rotation.
- param backup_count:
The number of backup log files to keep.
- returns:
A logging configuration dictionary.
Get the configuration for the current environment.
- returns:
The configuration instance for the current environment.
Set up Sentry for error tracking.
- param dsn:
The Sentry DSN.
- param environment:
The environment name.
- param release:
The release version.