Merge branch 'master' of https://gitea.airlabs.art/zyc/airlabs-manage
This commit is contained in:
commit
268c89e15c
@ -9,5 +9,8 @@ SECRET_KEY = os.getenv("SECRET_KEY", "airlabs-project-secret-key-change-in-produ
|
||||
ALGORITHM = "HS256"
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES = 60 * 24 # 24 小时
|
||||
|
||||
# CORS
|
||||
CORS_ORIGINS = os.getenv("CORS_ORIGINS", "*").split(",")
|
||||
|
||||
# 成本计算
|
||||
WORKING_DAYS_PER_MONTH = 22
|
||||
|
||||
@ -13,10 +13,11 @@ Base.metadata.create_all(bind=engine)
|
||||
|
||||
app = FastAPI(title="AirLabs Project", version="1.0.0")
|
||||
|
||||
# CORS(开发阶段允许所有来源)
|
||||
# CORS
|
||||
from config import CORS_ORIGINS
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["*"],
|
||||
allow_origins=CORS_ORIGINS,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
|
||||
@ -4,4 +4,5 @@ sqlalchemy
|
||||
pydantic
|
||||
python-jose[cryptography]
|
||||
passlib[bcrypt]
|
||||
bcrypt==4.0.1
|
||||
python-multipart
|
||||
|
||||
1
frontend/.env.development
Normal file
1
frontend/.env.development
Normal file
@ -0,0 +1 @@
|
||||
VITE_API_BASE_URL=http://localhost:8000/api
|
||||
1
frontend/.env.production
Normal file
1
frontend/.env.production
Normal file
@ -0,0 +1 @@
|
||||
VITE_API_BASE_URL=https://airlabs-manage-api.airlabs.art/api
|
||||
@ -2,15 +2,6 @@ server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
# API 代理到后端服务(K8s 内部通信)
|
||||
location /api {
|
||||
proxy_pass http://airlabs-manage-backend:8000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
|
||||
@ -3,7 +3,7 @@ import { ElMessage } from 'element-plus'
|
||||
import router from '../router'
|
||||
|
||||
const api = axios.create({
|
||||
baseURL: '/api',
|
||||
baseURL: import.meta.env.VITE_API_BASE_URL || '/api',
|
||||
timeout: 30000,
|
||||
})
|
||||
|
||||
|
||||
@ -39,6 +39,9 @@ spec:
|
||||
# 生产环境 JWT 密钥(部署前请修改)
|
||||
- name: SECRET_KEY
|
||||
value: "Ui5-xEvtAhKRDtlXKzDfd7TElsVZFUhakff0qcjn8jU"
|
||||
# CORS 允许的域名
|
||||
- name: CORS_ORIGINS
|
||||
value: "https://airlabs-manage-web.airlabs.art"
|
||||
volumeMounts:
|
||||
- name: sqlite-data
|
||||
mountPath: /app/data
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user