token_json文件写入

This commit is contained in:
CopilotLaLaLa 2022-06-12 15:16:07 +00:00 committed by GitHub
parent 5fd687c1e4
commit 3667724061
4 changed files with 15 additions and 7 deletions

View File

@ -13,4 +13,4 @@ SESSION_EXPIRE_TIMEOUT=30
DEBUG=False
# 服务器和端口
HOST = 127.0.0.1
PORT = 8080
PORT = 8090

6
.gitignore vendored
View File

@ -8,6 +8,12 @@ __pycache__/
*.so
# Distribution / packaging
.vscode
data
resources
configs
.env.dev
*.env.dev
.Python
build/
develop-eggs/

View File

@ -11,14 +11,14 @@ NICKNAME: str = "小真寻"
# 示例:"bind": "postgresql://user:password@127.0.0.1:5432/database"
bind: str = "" # 数据库连接链接
sql_name: str = "postgresql"
user: str = "" # 数据用户名
password: str = "" # 数据库密码
address: str = "" # 数据库地址
port: str = "" # 数据库端口
database: str = "" # 数据库名称
user: str = "uname" # 数据用户名
password: str = "zhenxun" # 数据库密码
address: str = "127.0.0.1" # 数据库地址
port: str = "5432" # 数据库端口
database: str = "postgres" # 数据库名称
# 代理,例如 "http://127.0.0.1:7890"
SYSTEM_PROXY: Optional[str] = None # 全局代理
SYSTEM_PROXY: Optional[str] = "http://127.0.0.1:7890" # 全局代理
Config = ConfigsManager(Path() / "data" / "configs" / "plugins2config.yaml")

View File

@ -76,6 +76,8 @@ async def login_get_token(form_data: OAuth2PasswordRequestForm = Depends()):
token_data["token"].append(access_token)
if len(token_data["token"]) > 3:
token_data["token"] = token_data["token"][1:]
with open(token_file, 'w', encoding="utf8") as f:
json.dump(token_data, f, ensure_ascii=False, indent=4)
return {"access_token": access_token, "token_type": "bearer"}