migrate to Pydantic v2 and optimize Caddyfile

This commit is contained in:
jingrow 2025-11-22 19:02:04 +08:00
parent 84b8c22942
commit e4407392bb
2 changed files with 10 additions and 12 deletions

View File

@ -57,8 +57,6 @@
handle /api/* {
reverse_proxy localhost:{$BACKEND_PORT:9001} {
header_up X-Real-IP {remote_host}
header_up X-Forwarded-For {remote_host}
header_up X-Forwarded-Proto {scheme}
}
}
@ -66,8 +64,6 @@
handle /jingrow* {
reverse_proxy localhost:{$BACKEND_PORT:9001} {
header_up X-Real-IP {remote_host}
header_up X-Forwarded-For {remote_host}
header_up X-Forwarded-Proto {scheme}
}
}

View File

@ -1,4 +1,5 @@
from pydantic_settings import BaseSettings
from pydantic import ConfigDict
from functools import lru_cache
from jingrow.utils.path import get_root_path
@ -47,11 +48,12 @@ class Settings(BaseSettings):
# 日志级别DEBUG/INFO/WARNING/ERROR/CRITICAL全局默认级别
log_level: str = 'INFO'
class Config:
env_file = str(get_root_path() / '.env')
env_file_encoding = 'utf-8'
case_sensitive = False
model_config = ConfigDict(
env_file=str(get_root_path() / '.env'),
env_file_encoding='utf-8',
case_sensitive=False,
extra='ignore'
)
@lru_cache()