feat: launch PK testing application
Verify and deploy API / verify-deploy (push) Failing after 1m3s

This commit is contained in:
2026-09-18 21:50:25 +08:00
commit 4d79c82695
22 changed files with 1189 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
from functools import lru_cache
from pydantic import Field
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
database_url: str = "sqlite:///./pk-lab.db"
token_secret: str = "development-only-change-me"
token_ttl_seconds: int = 60 * 60 * 24 * 30
cors_origins: str = "http://localhost:3001,http://localhost:3002"
public_base_url: str = "http://localhost:18082"
test_auth_enabled: bool = False
xhs_token_url: str = "https://miniapp.xiaohongshu.com/api/rmp/token"
xhs_session_url: str = "https://miniapp.xiaohongshu.com/api/rmp/session"
xhs_hub_app_id: str = ""
xhs_hub_app_secret: str = Field(default="", repr=False)
xhs_rice_app_id: str = ""
xhs_rice_app_secret: str = Field(default="", repr=False)
@property
def cors_origin_list(self) -> list[str]:
return [item.strip() for item in self.cors_origins.split(",") if item.strip()]
def app_credentials(self, app_key: str) -> tuple[str, str]:
if app_key == "hub":
return self.xhs_hub_app_id, self.xhs_hub_app_secret
if app_key == "rice":
return self.xhs_rice_app_id, self.xhs_rice_app_secret
raise ValueError("unknown app_key")
@lru_cache
def get_settings() -> Settings:
return Settings()