diff --git a/.env.example b/.env.example index e6d812e..01dd814 100644 --- a/.env.example +++ b/.env.example @@ -84,10 +84,9 @@ LOGGER_FILTERED_NAMES=["uvicorn","ErrorPush","ApiHelper"] # ENKA_NETWORK_API_AGENT="" # Web Server -# WEB_SWITCH=False # 是否开启 -# WEB_URL=http://localhost:8080/ -# WEB_HOST=localhost -# WEB_PORT=8080 +# WEB_ENABLE=False # 是否开启 WebServer +# WEB_HOST=localhost # WebServer 监听地址 +# WEB_PORT=8080 # WebServer 监听端口 # error # ERROR_PB_URL=https://fars.ee diff --git a/core/config.py b/core/config.py index 78cc902..fab896e 100644 --- a/core/config.py +++ b/core/config.py @@ -68,13 +68,17 @@ class WebServerConfig(Settings): enable: bool = False """是否启用WebServer""" - url: AnyUrl = "http://localhost:8080" host: str = "localhost" port: int = 8080 class Config(Settings.Config): env_prefix = "web_" + @property + def url(self) -> str: + # noinspection HttpUrlsUsage + return "http://" + self.host + ":" + str(self.port) + class ErrorConfig(Settings): pb_url: str = ""