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.
This commit is contained in:
1 parent
0fa0406770
commit
d7927d4759
5 files changed
+16
No files matched your search
@@ -320,4 +320,9 @@ server.listen(PORT, HOST, () => {
|
||||
? `[hobbypj] ย้ายข้อมูลจาก projects.json เข้าฐานข้อมูลแล้ว ${seed.count} รายการ`
|
||||
: `[hobbypj] ฐานข้อมูลพร้อมใช้ (${seed.reason})`,
|
||||
);
|
||||
if (!ADMIN_TOKEN) {
|
||||
console.log(
|
||||
"[hobbypj] ยังไม่ตั้ง ADMIN_TOKEN: เขียนได้เฉพาะ request จาก loopback — ถ้ารันใน container ต้องตั้ง ADMIN_TOKEN ไม่งั้นหน้าเว็บเผยแพร่ไม่ได้",
|
||||
);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user