mirror of
https://github.com/dalbodeule/hop-gate.git
synced 2025-12-07 12:25:44 +09:00
- Introduced a new `legoManager` for managing per-domain TLS certificates. - Implemented ACME HTTP-01 challenge handling with a configurable webroot directory. - Created `NewLegoManagerFromEnv` to initialize ACME settings from environment variables. - Added `verifyDomainsResolve` to validate domain DNS resolutions. - Updated `.gitignore` to include ACME cache and webroot directories. - Updated `go.mod` and `go.sum` with new dependencies, including `go-acme/lego`.
121 lines
4.0 KiB
Plaintext
121 lines
4.0 KiB
Plaintext
# hop-gate .env example
|
|
#
|
|
# 이 파일을 복사해서 `.env` 로 이름을 바꾼 뒤 값을 채워서 사용하세요.
|
|
# internal/config 패키지의 LoadServerConfigFromEnv / LoadClientConfigFromEnv 가
|
|
# .env를 먼저 읽고, 이후 환경변수로부터 설정을 구성합니다.
|
|
#
|
|
# Server-side PostgreSQL connection for admin/domain management uses:
|
|
# HOP_DB_DSN
|
|
# HOP_DB_MAX_OPEN_CONNS
|
|
# HOP_DB_MAX_IDLE_CONNS
|
|
# HOP_DB_CONN_MAX_LIFETIME
|
|
|
|
# ---- Logging / Loki ----
|
|
|
|
# 로그 레벨: debug/info/warn/error
|
|
HOP_LOG_LEVEL=info
|
|
|
|
# Loki HTTP push 사용 여부 (Promtail 없이 직접 push 할 때 true)
|
|
HOP_LOKI_ENABLE=false
|
|
|
|
# Loki HTTP push 엔드포인트 (예: http://loki:3100/loki/api/v1/push)
|
|
#HOP_LOKI_ENDPOINT=http://loki:3100/loki/api/v1/push
|
|
|
|
# 멀티 테넌시 Loki 사용 시 Tenant ID (X-Scope-OrgID 등으로 사용)
|
|
#HOP_LOKI_TENANT_ID=
|
|
|
|
# Basic Auth 자격 증명 (필요할 때만)
|
|
#HOP_LOKI_USERNAME=
|
|
#HOP_LOKI_PASSWORD=
|
|
|
|
# 모든 로그에 공통으로 붙일 라벨 (콤마 구분: key=value,key2=value2)
|
|
# 예: app=hop-gate,env=dev,region=ap-northeast-2
|
|
#HOP_LOKI_STATIC_LABELS=app=hop-gate,env=dev,region=ap-northeast-2
|
|
|
|
|
|
# ---- Server ports & domains ----
|
|
|
|
# HTTP 리스닝 포트 (보통 :80, ACME HTTP-01 및 HTTPS 리다이렉트용)
|
|
HOP_SERVER_HTTP_LISTEN=:8080
|
|
|
|
# HTTPS 리스닝 포트 (보통 :443)
|
|
HOP_SERVER_HTTPS_LISTEN=:8443
|
|
|
|
# DTLS 리스닝 포트 (보통 :443, 필요시 별도 포트 사용)
|
|
HOP_SERVER_DTLS_LISTEN=:8443
|
|
|
|
# 메인 도메인 (예: example.com)
|
|
HOP_SERVER_DOMAIN=example.com
|
|
|
|
# 디버깅용 플래그
|
|
# 1. self signed localhost cert 사용여부 (debug: true -> 사용)
|
|
HOP_SERVER_DEBUG=true
|
|
|
|
# ---- ACME / Let's Encrypt (server-side) ----
|
|
#
|
|
# ACME 계정 이메일 (필수)
|
|
# ACME account email (required)
|
|
HOP_ACME_EMAIL=admin@example.com
|
|
#
|
|
# ACME/lego 캐시 디렉터리 (인증서 및 계정 정보 저장) (필수)
|
|
# ACME/lego cache directory (stores certs and account data) (required)
|
|
HOP_ACME_CACHE_DIR=./acme-cache
|
|
#
|
|
# ACME 디렉터리 URL (선택, 기본값은 Let's Encrypt production/staging)
|
|
# ACME directory URL (optional, defaults to Let's Encrypt production/staging)
|
|
# 예: https://acme-staging-v02.api.letsencrypt.org/directory
|
|
#HOP_ACME_CA_DIR=
|
|
#
|
|
# true 이면 Let's Encrypt Staging CA 사용 (테스트용)
|
|
# If true, use Let's Encrypt Staging CA (for testing)
|
|
HOP_ACME_USE_STAGING=true
|
|
#
|
|
# 도메인 DNS가 resolve 되어야 할 기대 IP 목록 (콤마 구분, 옵션)
|
|
# Expected IPs that domains must resolve to via 1.1.1.1 DNS (comma-separated, optional)
|
|
# 예: 1.2.3.4,5.6.7.8
|
|
#HOP_ACME_EXPECT_IPS=1.2.3.4,5.6.7.8
|
|
#
|
|
# ACME HTTP-01 webroot 디렉터리 (필수, webroot 모드 사용 시)
|
|
# go-acme/lego 가 /.well-known/acme-challenge/{token} 파일을 생성하는 디렉터리입니다.
|
|
# 메인 HTTP 서버는 이 디렉터리에서 해당 토큰 파일을 서빙해야 합니다.
|
|
# ACME HTTP-01 webroot directory (required when using webroot mode).
|
|
# go-acme/lego writes challenge files here and the main HTTP server must serve
|
|
# /.well-known/acme-challenge/{token} from this directory.
|
|
HOP_ACME_WEBROOT=./acme-webroot
|
|
|
|
|
|
# ---- PostgreSQL (server-side) ----
|
|
#
|
|
# PostgreSQL DSN (required), e.g.:
|
|
# postgres://user:pass@localhost:5432/hopgate?sslmode=disable
|
|
HOP_DB_DSN=postgres://user:pass@localhost:5432/hopgate?sslmode=disable
|
|
|
|
# Maximum number of open connections (optional, default: 10)
|
|
#HOP_DB_MAX_OPEN_CONNS=10
|
|
|
|
# Maximum number of idle connections (optional, default: 5)
|
|
#HOP_DB_MAX_IDLE_CONNS=5
|
|
|
|
# Connection max lifetime (optional, default: 30m)
|
|
# e.g. "30m", "1h"
|
|
#HOP_DB_CONN_MAX_LIFETIME=30m
|
|
|
|
# ---- Client settings ----
|
|
|
|
# DTLS 서버 주소 (host:port)
|
|
# 예: example.com:443
|
|
HOP_CLIENT_SERVER_ADDR=localhost:8443
|
|
|
|
# 클라이언트 도메인
|
|
HOP_CLIENT_DOMAIN=test.example.com
|
|
|
|
# 인증 토큰 (서버에서 검증용으로 사용 가능)
|
|
HOP_CLIENT_API_KEY=TEST_API_KEY_0123456789_ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
|
|
|
|
# 서비스 매핑: name=host:port 형태
|
|
HOP_CLIENT_LOCAL_TARGET=127.0.0.1:8080
|
|
|
|
# 디버깅용 플래그
|
|
# 1. self signed 인증서를 신뢰(인증서 체인 검증 스킵)
|
|
HOP_CLIENT_DEBUG=true
|