-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathenv.example
More file actions
284 lines (251 loc) · 11.9 KB
/
Copy pathenv.example
File metadata and controls
284 lines (251 loc) · 11.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# =============================================================================
# IGLOO SERVER ENVIRONMENT CONFIGURATION
# =============================================================================
# Copy this file to .env and customize the values for your deployment
# Never commit your .env file to version control!
# =============================================================================
# OPERATION MODE
# =============================================================================
# HEADLESS mode: When true, uses environment variables for configuration (traditional mode)
# When false (default), uses database for user management and credential storage
HEADLESS=false
# =============================================================================
# DATABASE MODE CONFIGURATION (HEADLESS=false)
# =============================================================================
# Admin secret for initial setup (required for first user creation)
# Generate a secure secret: openssl rand -hex 32
# REQUIRED in HEADLESS=false. Server should refuse to start if unset or left as a placeholder.
# ---
# SECURITY WARNING: DO NOT LEAVE THIS AS THE DEFAULT VALUE.
# The server will refuse to start in database mode if this is not set to a secure, unique secret.
ADMIN_SECRET=REQUIRED_ADMIN_SECRET_NOT_SET
# Database path (optional, defaults to ./data)
# DB_PATH=/path/to/database
# =============================================================================
# HEADLESS MODE CONFIGURATION (HEADLESS=true)
# =============================================================================
# FROSTR credentials - Only used when HEADLESS=true
# Your FROSTR group and share credentials from Igloo Desktop
# Leave empty to start server in configuration-only mode
GROUP_CRED=
SHARE_CRED=
# Optional: Display name for your signing group (HEADLESS mode only)
GROUP_NAME=
# Optional: Directional peer policies for headless mode (JSON array or single object)
# Only overrides that block a direction are persisted (defaults are allow/allow)
# Example: PEER_POLICIES=[{"pubkey":"abcdef...","allowSend":false}] # blocks outbound, leaves inbound default
PEER_POLICIES=
# =============================================================================
# SERVER CONFIGURATION
# =============================================================================
# Server host and port settings
# Use 'localhost' for local development, '0.0.0.0' for Docker deployments
HOST_NAME=localhost
HOST_PORT=8002
# Nostr relay URLs for FROSTR protocol communication
# Can be JSON array or comma-separated string
# Examples:
# JSON: ["wss://relay.primal.net","wss://relay.damus.io"]
# CSV: wss://relay.primal.net,wss://relay.damus.io
RELAYS=["wss://relay.primal.net"]
# =============================================================================
# SECURITY CONFIGURATION
# =============================================================================
# Enable/disable authentication (set to 'false' for local development only)
# SECURITY WARNING: Never set to 'false' in production!
AUTH_ENABLED=true
# CORS (Cross-Origin Resource Sharing) Configuration
# Comma-separated list of allowed origins for API requests
# Examples:
# Development: http://localhost:3000,http://localhost:8002
# Production: https://yourdomain.com,https://admin.yourdomain.com
# If not set:
# - In development: wildcard (*) is used for convenience.
# - In production: no CORS header is set, so browsers block cross-origin requests.
# WebSocket upgrades use a separate Origin enforcement path and support a special token:
# - `@self` allows any Origin whose host matches the request host (port-agnostic).
ALLOWED_ORIGINS=http://localhost:3000,http://localhost:8002
# API Key Authentication
# Generate with: openssl rand -hex 32
# Used with header: X-API-Key: your-key or Authorization: Bearer your-key
API_KEY=your-secure-api-key-here
# Basic Authentication (username/password)
# Used for web UI login and HTTP basic auth
BASIC_AUTH_USER=admin
BASIC_AUTH_PASS=your-secure-password-here
# Session Management
# Used for web UI session cookies.
# If unset, the server auto-generates a 32-byte secret (64 hex chars) and persists it to:
# - `<DB_PATH>/.session-secret` (or `./data/.session-secret` when `DB_PATH` is unset).
# In `NODE_ENV=production`, failure to load/generate/persist is fatal (process exits).
# In headless mode with a non-empty `API_KEY`, sessions are disabled to avoid file I/O.
# Optional override (must be 64 hex chars):
# SESSION_SECRET=your-64-hex-session-secret-here
SESSION_TIMEOUT=3600 # Session timeout in seconds (3600 = 1 hour)
# =============================================================================
# RATE LIMITING
# =============================================================================
# Enable/disable rate limiting protection
RATE_LIMIT_ENABLED=true
# Rate limit window in seconds (900 = 15 minutes)
RATE_LIMIT_WINDOW=900
# Maximum requests per window per IP address
RATE_LIMIT_MAX=600
# WebSocket abuse settings: see WEBSOCKET ABUSE PROTECTION (ADVANCED) below.
# NIP-46 session creation limits (per user)
# Defaults: 1 hour window across modes
NIP46_SESSION_RATE_LIMIT_WINDOW=3600
# Defaults: 30 sessions/hour in HEADLESS mode, 120 sessions/hour when DB backed
NIP46_SESSION_RATE_LIMIT_MAX=120
# =============================================================================
# OPERATION TIMEOUTS (ADVANCED)
# =============================================================================
# Signing operation timeout (ms). Alias: SIGN_TIMEOUT_MS (legacy).
# Clamped to 1000..120000ms.
# FROSTR_SIGN_TIMEOUT=30000
# SIGN_TIMEOUT_MS=30000
#
# Connectivity ping timeout (ms). Alias: PING_TIMEOUT_MS (legacy).
# Clamped to 1000..120000ms.
# CONNECTIVITY_PING_TIMEOUT_MS=10000
# PING_TIMEOUT_MS=10000
#
# Relay publish receipt timeout (ms). Alias: RELAY_PUBLISH_TIMEOUT (legacy).
# Clamped to 1000..120000ms.
# PUBLISH_EVENT_TIMEOUT_MS=30000
# RELAY_PUBLISH_TIMEOUT=30000
#
# Startup echo timeouts (ms). Alias: ECHO_TIMEOUT_MS (legacy).
# Clamped to 1000..60000ms.
# SELF_ECHO_TIMEOUT_MS=10000
# ECHO_TIMEOUT_MS=10000
# =============================================================================
# WEBSOCKET ABUSE PROTECTION (ADVANCED)
# =============================================================================
# WebSocket upgrade rate limiting (both `/api/events` and `/` upgrades).
# Defaults: window=RATE_LIMIT_WINDOW, max=30.
# RATE_LIMIT_WS_UPGRADE_WINDOW=900
# RATE_LIMIT_WS_UPGRADE_MAX=30
#
# Per-IP connection cap and message rate limiting (token bucket).
# WS_MAX_CONNECTIONS_PER_IP=5
# WS_MSG_RATE=20
# WS_MSG_BURST=40
#
# Legacy WebSocket auth compatibility for `/api/events`:
# - true (default): allow `?apiKey=` / `?sessionId=` query params on upgrades.
# - false: require headers or `Sec-WebSocket-Protocol` auth hints instead.
# ALLOW_QUERY_CREDENTIALS=true
# =============================================================================
# RECOVERY RATE LIMITS (ADVANCED)
# =============================================================================
# Recovery endpoint throttling (defaults: window=RATE_LIMIT_WINDOW, max=3).
# RATE_LIMIT_RECOVERY_WINDOW=900
# RATE_LIMIT_RECOVERY_MAX=3
# =============================================================================
# NODE LIFECYCLE & RELAY PROBING (ADVANCED)
# =============================================================================
# Relay probing:
# - SKIP_RELAY_PROBE=true: skip probing entirely (fastest startup).
# - DEFER_RELAY_PROBE=true: start immediately; probe in background for diagnostics only (ignored if SKIP_RELAY_PROBE=true).
# SKIP_RELAY_PROBE=false
# DEFER_RELAY_PROBE=false
#
# Skip headless startup echo broadcasts (perf option).
# SKIP_STARTUP_ECHO=false
#
# Bounds peer status memory (FIFO eviction).
# MAX_PEER_STATUS_ENTRIES=1000
# =============================================================================
# ERROR CIRCUIT BREAKER (ADVANCED)
# =============================================================================
# Exit the process after repeated unhandled exceptions (for supervisors to restart cleanly).
# ERROR_CIRCUIT_WINDOW_MS=60000
# ERROR_CIRCUIT_THRESHOLD=10
# ERROR_CIRCUIT_EXIT_CODE=1
# =============================================================================
# UPDATE CHECKS (`GET /api/update`) (ADVANCED)
# =============================================================================
# Disable update checks.
# UPDATE_CHECK_DISABLED=false
#
# Mark deployment as managed (also treated as managed when HEADLESS=true or SKIP_ADMIN_SECRET_VALIDATION=true).
# MANAGED_DEPLOYMENT=false
#
# GitHub API token to avoid rate limits (optional).
# GITHUB_TOKEN=
#
# Update check timeouts and cache TTLs (ms).
# UPDATE_CHECK_TIMEOUT_MS=5000
# UPDATE_CHECK_TTL_MS=21600000 # 6 hours
# UPDATE_CHECK_FAILURE_TTL_MS=900000 # 15 minutes
#
# Override version reported by `/api/update` (intended for packaged builds).
# APP_VERSION=
# =============================================================================
# ONBOARDING HARDENING (DB MODE ONLY) (ADVANCED)
# =============================================================================
# Stabilizes per-client identifiers across restarts; leave unset to use a best-effort fallback.
# FINGERPRINT_SECRET=
#
# Bounds the in-memory client-id cache lifetime (ms). Default 86400000, clamped 10m..7d.
# CLIENT_ID_TTL_MS=86400000
#
# Diagnostic logging for fingerprint fallbacks (avoid in production unless troubleshooting).
# LOG_FINGERPRINT_FALLBACK=false
# =============================================================================
# UI EVENT LOG (DB MODE ONLY) (ADVANCED)
# =============================================================================
# By default, `/ping/*` messages are suppressed from the persisted UI event log to avoid runaway growth
# on long-running deployments. Enable only when debugging ping behavior.
# UI_EVENT_LOG_INCLUDE_PINGS=false
#
# Optional: auto-delete older persisted UI event log entries (and unreferenced payload blobs).
# Set to a positive integer number of days. Example: keep 30 days of history.
# UI_EVENT_LOG_RETENTION_DAYS=30
# =============================================================================
# MANAGED INSTALL FLAGS (ADVANCED)
# =============================================================================
# Skip the onboarding "Enter Admin Secret" UI step (Umbrel-style managed deployments only).
# SKIP_ADMIN_SECRET_VALIDATION=false
#
# Auto-generate an ephemeral ADMIN_SECRET in CI/test or when explicitly enabled (non-production only).
# AUTO_ADMIN_SECRET=false
# =============================================================================
# ENVIRONMENT MODE
# =============================================================================
# Set to 'production' for production deployments
# This affects cookie security flags and other settings
NODE_ENV=development
# =============================================================================
# SECURITY EXAMPLES BY DEPLOYMENT TYPE
# =============================================================================
# DEVELOPMENT (Local testing - minimal security)
# AUTH_ENABLED=false
# NODE_ENV=development
# PERSONAL (Home server - medium security)
# AUTH_ENABLED=true
# API_KEY=personal-server-key-2024
# SESSION_SECRET=<generate-64-hex-with-openssl-rand-hex-32>
# SESSION_TIMEOUT=7200
# RATE_LIMIT_MAX=50
# TEAM (Shared server - good security)
# AUTH_ENABLED=true
# BASIC_AUTH_USER=teamadmin
# BASIC_AUTH_PASS=SecureTeamPassword123!
# API_KEY=team-automation-key-64chars
# SESSION_SECRET=<generate-64-hex-with-openssl-rand-hex-32>
# SESSION_TIMEOUT=3600
# RATE_LIMIT_MAX=100
# PRODUCTION (Public/cloud - high security)
# AUTH_ENABLED=true
# ALLOWED_ORIGINS=https://yourdomain.com,https://admin.yourdomain.com
# BASIC_AUTH_USER=prodadmin
# BASIC_AUTH_PASS=VerySecurePassword456!
# API_KEY=prod-api-key-with-64-random-chars-abcdef123456789
# SESSION_SECRET=<generate-64-hex-with-openssl-rand-hex-32>
# SESSION_TIMEOUT=1800
# RATE_LIMIT_ENABLED=true
# RATE_LIMIT_WINDOW=300
# RATE_LIMIT_MAX=30
# NODE_ENV=production