Files
hobbypj-contents/.env.example
T
Bkk1234 d7927d4759 build(docker): keep dev database out of the image, warn when ADMIN_TOKEN is unset
- .dockerignore: exclude data/*.sqlite*, data/backups, data/projects.migrated.json so a
  fresh container always seeds from data/projects.json (the dev DB was being baked in)
- publish.mjs: log a hint that requests through a published port are not loopback, so a
  container without ADMIN_TOKEN cannot write
- .env.example / README / AGENTS.md: document the ADMIN_TOKEN requirement for containers

Verified with docker 27.4.0: image build, PORT env (8110/8112 incl. .env), seed 6 rows,
PUT with x-admin-token, VACUUM INTO backup, SQLite on a Windows bind mount
(integrity_check ok), persistence across restart, compose up with PORT + volume override.
2026-11-23 00:39:44 +07:00

21 lines
1.3 KiB
Bash

# คัดลอกเป็น .env แล้วแก้ค่าตามเครื่อง (ไฟล์ .env ไม่ขึ้น git)
# พอร์ตที่เปิดทั้งฝั่งโฮสต์และใน container (แอปอ่านตัวเดียวกัน)
PORT=8090
# 127.0.0.1 = เฉพาะเครื่องนี้ · 0.0.0.0 = ให้เครื่องอื่น/LAN เข้าได้
BIND_ADDRESS=127.0.0.1
# รหัสเผยแพร่หลังบ้าน — ถ้าเว้นว่างจะอนุญาตเฉพาะ request จาก loopback
# (ใน container ต้องตั้งค่านี้ ไม่งั้นคำขอที่เข้ามาทางพอร์ต mapping จะเขียนไม่ได้ → 403)
ADMIN_TOKEN=
# 1 = หลังบ้าน commit + push ขึ้น Gitea (ต้องมี .git ใน /app) · 0 = เขียนไฟล์อย่างเดียว
PUBLISH_PUSH=0
# ที่อยู่ไฟล์ฐานข้อมูล SQLite (เทียบกับ root ของโปรเจค) — เว้นว่าง = data/hobbypj.sqlite
DB_PATH=data/hobbypj.sqlite
# ชื่อ container
CONTAINER_NAME=hobbypj-contents