From 0c73d655a7ae09843496636bdfa987349b2447b1 Mon Sep 17 00:00:00 2001 From: th-kim0823 Date: Sat, 25 Apr 2026 19:45:18 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20.env=20=EA=B8=B0=EB=B0=98=20ADMIN=5FTOK?= =?UTF-8?q?EN=20=EA=B4=80=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - docker-compose가 .env 자동 로드 - .env는 gitignore (token 노출 방지) - .env.example 템플릿 추가 - README 절차 업데이트 Co-Authored-By: Claude Opus 4.7 (1M context) --- .env.example | 2 ++ .gitignore | 1 + README.md | 10 ++++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..b3632e7 --- /dev/null +++ b/.env.example @@ -0,0 +1,2 @@ +ADMIN_TOKEN=강한-랜덤-토큰-여기-넣기 +PORT=8501 diff --git a/.gitignore b/.gitignore index 0463afa..8243d69 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ venv/ *.db *.sqlite .env +!.env.example .streamlit/secrets.toml diff --git a/README.md b/README.md index 4dcf293..ced30be 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,12 @@ # 1. 팀 배정 (호스트에서 1회, participants.json 생성) python3 assign_teams.py -# 2. 컨테이너 실행 -export ADMIN_TOKEN="강한-토큰-아무거나" +# 2. .env 작성 (1회) +cp .env.example .env +# .env 파일을 열어 ADMIN_TOKEN을 강한 랜덤 토큰으로 변경 +# 빠르게: python3 -c "import secrets; print(secrets.token_urlsafe(16))" + +# 3. 컨테이너 실행 docker compose up -d --build # 로그 @@ -28,6 +32,8 @@ docker compose down docker compose down -v ``` +`.env`는 git ignore. token 노출 방지. + - 투표 DB는 docker volume `vote-data`에 영속 → 컨테이너 재시작해도 유지 - `participants.json`은 호스트→컨테이너 read-only mount → 재배정 시 호스트에서 변경하고 컨테이너만 재시작