From 9e72e4de8efb8cd4b87dc3276b12e88efc48058d Mon Sep 17 00:00:00 2001 From: lezi-fun <177434121+lezi-fun@users.noreply.github.com> Date: Sun, 9 Aug 2026 21:26:29 +0800 Subject: [PATCH] chore: allow .env in repo, add .env.example template - .gitignore: track .env, still ignore local overrides (.env.local) - Add .env.example with DATABASE_URL / JWT_SECRET / PORT / HOST --- .env.example | 12 ++++++++++++ .gitignore | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..8d5b396 --- /dev/null +++ b/.env.example @@ -0,0 +1,12 @@ +# Forumlify 环境变量示例 +# 复制为 .env 并按需修改 + +# PostgreSQL 连接串(默认与 docker-compose.yml 一致) +DATABASE_URL=postgresql://forumlify:123456@localhost:5432/forumlify + +# JWT 签名密钥(生产环境务必修改为随机长字符串) +JWT_SECRET=forumlify-secret-key-change-me-in-production + +# 可选:监听端口/地址(也可在 config.js 中设置 SERVER_PORT / SERVER_HOST) +# PORT=3000 +# HOST=0.0.0.0 diff --git a/.gitignore b/.gitignore index 097a6e6..4f2257d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,8 @@ out/ uploads/ *.log .DS_Store -.env + +# .env 允许提交到仓库(项目约定) +# 仅忽略本地覆盖文件 +.env.local +.env.*.local