🐛 Fix WebServer configuration

Co-authored-by: Karako <karakohear@gmail.com>
This commit is contained in:
洛水居室 2023-04-27 22:49:47 +08:00
parent e086820851
commit dfe58215ae
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC
2 changed files with 8 additions and 5 deletions

View File

@ -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

View File

@ -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 = ""