mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 15:38:19 +08:00
refactor: inject token runtime configuration
This commit is contained in:
@@ -6,6 +6,7 @@ from app.application.configuration import (
|
||||
ApiRuntimeConfig,
|
||||
ChainRuntimeConfig,
|
||||
SchedulerRuntimeConfig,
|
||||
TokenRuntimeConfig,
|
||||
)
|
||||
from app.runtime.config import Settings
|
||||
from app.schemas.types import MediaType
|
||||
@@ -52,6 +53,16 @@ def build_api_runtime_config(settings: Settings) -> ApiRuntimeConfig:
|
||||
)
|
||||
|
||||
|
||||
def build_token_runtime_config(settings: Settings) -> TokenRuntimeConfig:
|
||||
"""从部署设置构建令牌编解码使用的安全配置快照。"""
|
||||
return TokenRuntimeConfig(
|
||||
secret_key=settings.SECRET_KEY,
|
||||
resource_secret_key=settings.RESOURCE_SECRET_KEY,
|
||||
access_token_expire_minutes=settings.ACCESS_TOKEN_EXPIRE_MINUTES,
|
||||
resource_access_token_expire_seconds=settings.RESOURCE_ACCESS_TOKEN_EXPIRE_SECONDS,
|
||||
)
|
||||
|
||||
|
||||
def build_scheduler_runtime_config(settings: Settings) -> SchedulerRuntimeConfig:
|
||||
"""从可热更新的部署设置构建一次 Scheduler 配置快照。"""
|
||||
return SchedulerRuntimeConfig(
|
||||
|
||||
Reference in New Issue
Block a user