-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.py
43 lines (37 loc) · 1.16 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# -*- coding:utf-8 -*-
"""
@Created on : 2022/4/22 22:02
@Author: binkuolo
@Des: 基本配置文件
"""
import os
from dotenv import load_dotenv, find_dotenv
from pydantic import BaseSettings
from typing import List
class Config(BaseSettings):
# 加载环境变量
load_dotenv(find_dotenv(), override=True)
# 调试模式
APP_DEBUG: bool = True
# 项目信息
VERSION: str = "0.0.1"
PROJECT_NAME: str = "fasdapi"
DESCRIPTION: str = '<a href="/redoc" target="_blank">redoc</a>'
# 静态资源目录
STATIC_DIR: str = os.path.join(os.getcwd(), "static")
TEMPLATE_DIR: str = os.path.join(STATIC_DIR, "templates")
# 跨域请求
CORS_ORIGINS: List = ["*"]
CORS_ALLOW_CREDENTIALS: bool = True
CORS_ALLOW_METHODS: List = ["*"]
CORS_ALLOW_HEADERS: List = ["*"]
# Session
SECRET_KEY = "session"
SESSION_COOKIE = "session_id"
SESSION_MAX_AGE = 14 * 24 * 60 * 60
# Jwt
JWT_SECRET_KEY = "09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7"
JWT_ALGORITHM = "HS256"
JWT_ACCESS_TOKEN_EXPIRE_MINUTES = 24 * 60
SWAGGER_UI_OAUTH2_REDIRECT_URL = "/api/v1/test/oath2"
settings = Config()