Files
2026-10-20 19:08:49 +08:00

47 lines
2.4 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.
# ============================================================
# Docker Compose 环境变量模板
# 用法:复制为同目录 .env(同目录被 .gitignore 与 .dockerignore 双重排除)
# copy .env.example .env
# 说明:本文件使用 MYSQL_HOST 等友好名,由 docker-compose.yml 的
# environment 块映射为 GF_ 规范键(如 GF_DATABASE_DEFAULT_LINK)
# 注入容器——应用只认 GF_ 前缀键,勿将友好名原样透传给应用
# 注意:值中含 $ 须写成 $$(compose 变量插值会吞掉单 $,
# 如密码 abc#$^ 应写为 abc#$$^)
# ============================================================
# ===== 应用 =====
APP_PORT=8000
# JWT 签名密钥(生产必改):要求 ≥32 字节密码学随机,禁止词典词/项目名
# 生成方式(任选其一,生成后替换下方示例值):
# Linux 部署机: openssl rand -hex 32
# 无 openssl 时: python3 -c "import secrets; print(secrets.token_hex(32))"
# Windows: [Convert]::ToBase64String([Security.Cryptography.RandomNumberGenerator]::GetBytes(32))
# 生成示例:a3f8c2d91e4b7f05...(64 位十六进制,各环境独立生成、勿复用同一值)
# 注意:轮换此值后所有已签发令牌立即失效,用户需重新登录(安排发版窗口执行)
JWT_SECRET=please-change-this-jwt-secret
# ===== MySQL =====
# 数据库地址(容器网络内地址)
# 连 compose 自带 mysql 服务:保持默认服务名 mysql
# 连宿主机数据库:Mac/Windows Docker Desktop 用 host.docker.internal,
# Linux 用宿主机实际 IP 或 --add-host=host.docker.internal:host-gateway
# 注意:容器内 127.0.0.1 指向容器自身,连不上宿主机数据库
MYSQL_HOST=mysql
# 数据库监听端口(进连接串;连外部库时填外部库端口)
# 注:自带 mysql/redis 服务的宿主映射端口已在 compose 写死(3306/6379),
# 仅供宿主机客户端直连调试,占用冲突时改 compose 的 ports
MYSQL_PORT=3306
MYSQL_USER=root
MYSQL_PASSWORD=root
MYSQL_DATABASE=easygoadmin.goframe.elevue
# ===== Redis =====
# 同 MYSQL_HOST 规则;容器内 127.0.0.1 指向容器自身,连不上宿主机 Redis
REDIS_HOST=redis
# 连宿主机 Redis 时改为(Windows/Mac Docker Desktop):
# REDIS_HOST=host.docker.internal
# Redis 监听端口(进连接串;连外部库时填外部端口)
REDIS_PORT=6379
REDIS_PASSWORD=123456