dify/api/configs/app_configs.py
Bowen Liang 3cc6093e4b
feat: introduce pydantic-settings for config definition and validation (#5202)
Co-authored-by: -LAN- <laipz8200@outlook.com>
2024-06-19 13:41:12 +08:00

43 lines
1.0 KiB
Python

from pydantic_settings import BaseSettings, SettingsConfigDict
from configs.deploy import DeploymentConfigs
from configs.enterprise import EnterpriseFeatureConfigs
from configs.extra import ExtraServiceConfigs
from configs.feature import FeatureConfigs
from configs.middleware import MiddlewareConfigs
from configs.packaging import PackagingInfo
class DifyConfigs(
# based on pydantic-settings
BaseSettings,
# Packaging info
PackagingInfo,
# Deployment configs
DeploymentConfigs,
# Feature configs
FeatureConfigs,
# Middleware configs
MiddlewareConfigs,
# Extra service configs
ExtraServiceConfigs,
# Enterprise feature configs
# **Before using, please contact business@dify.ai by email to inquire about licensing matters.**
EnterpriseFeatureConfigs,
):
model_config = SettingsConfigDict(
# read from dotenv format config file
env_file='.env',
env_file_encoding='utf-8',
# ignore extra attributes
extra='ignore',
)