Files
2026-10-18 08:55:43 +08:00

43 lines
1.9 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 复制为 .env 后按需修改:cp .env.example .env
# .env 会被 docker compose 自动读取,不要提交到公开仓库
# ============ 鉴权(三选一,推荐第 1 种) ============
# 生成 token:openssl rand -hex 24 或 python -c "import secrets;print(secrets.token_urlsafe(32))"
# 1) 多 token(推荐):名称:token,名称2:token2
# 每个调用方发一把,吊销时只删对应的那一段,不影响别人。
# 日志里会打印调用方名称,方便排查是谁在调。
API_TOKENS=frontend:c419f1c903ac03c4f4329f21a8f49af57118fc1bce6660f2,win-service:3444df79189bbf16e872d109c5d56bc7684e24645c39b416
# 2) 旧版单密钥(兼容保留,不推荐):所有调用方共用一把
# API_KEY=
# 3) 短期 token(可选):设置后启用 POST /api/v1/auth/token
# 调用方用 client_secret 换有效期 TOKEN_TTL 秒的签名 token,
# 适合前端——页面里不硬编码长期密钥,只持有短时 token。
# CLIENT_ID=default
# CLIENT_SECRET=
# TOKEN_TTL=3600
# ============ 跨域 ============
# 允许跨域的前端来源,逗号分隔。浏览器里的 Vue/React 页面调这个接口必须配。
# * = 允许所有来源(方便开发,但任何网页都能读结果,生产环境务必收紧)
# 例:CORS_ORIGINS=http://10.1.1.163:5173,http://10.1.1.163:8080
# 后端到后端调用(curl / requests / 其他容器)不受此项影响。
CORS_ORIGINS=*
# ============ 基础镜像源 ============
# 默认国内公共源(fnOS 自带加速源需授权,常 401)。
# 备选:
# BASE_IMAGE=docker.1ms.run/library/python:3.11-slim
# BASE_IMAGE=mirror.ccs.tencentyun.com/library/python:3.11-slim
# 离线导入基础镜像(docker load)后改用本地 tag:
# BASE_IMAGE=python:3.11-slim
# BASE_IMAGE=docker.m.daocloud.io/library/python:3.11-slim
# —— 以下一般不用改,低配吃紧时再动 ——
# MAX_SIDE=960
# DET_LIMIT_SIDE_LEN=736
# MAX_DIMENSION=6000
# MAX_IMAGE_BYTES=5242880