-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy path.env.example
More file actions
146 lines (121 loc) · 5.44 KB
/
Copy path.env.example
File metadata and controls
146 lines (121 loc) · 5.44 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
# Server Configuration
PORT=3000
NODE_ENV=development
# AI Service Configuration
# AI provider selection: "openrouter" (default) or "ollama"
AI_PROVIDER=openrouter
# OpenRouter Configuration (when AI_PROVIDER=openrouter)
OPENROUTER_API_KEY=your_openrouter_key_here
# Any OpenRouter text model - see https://openrouter.ai/models for options.
# Demo default matches gateway/CI/deployment docs; replace if needed.
OPENROUTER_MODEL=z-ai/glm-4.5-air:free
# Optional: override the OpenRouter endpoint (used in tests)
# OPENROUTER_URL=http://127.0.0.1:8080/api/v1/chat/completions
# Ollama Configuration (when AI_PROVIDER=ollama)
# OLLAMA_URL=http://localhost:11434
# OLLAMA_MODEL=llama2
# Payment Configuration
# Private key for the server wallet (recipient of payments) - REQUIRED
SERVER_WALLET_PRIVATE_KEY=your_private_key_here
# Recipient address embedded in payment contexts.
RECIPIENT_ADDRESS=0x2cAF48b4BA1C58721a85dFADa5aC01C2DFa62219
# Chain ID used by the gateway payment context (84532 = Base Sepolia)
CHAIN_ID=84532
# Token Configuration
# USDC_TOKEN_ADDRESS is reserved for future on-chain settlement and is not read by the current gateway/verifier.
# USDC_TOKEN_ADDRESS=
PAYMENT_AMOUNT=0.001
# Receipt Configuration
# Receipt storage backend: "redis" (default, survives restarts) or "memory" (tests/local only)
RECEIPT_STORE=redis
# Time-to-live for receipts in seconds (default: 86400 = 24 hours)
RECEIPT_TTL=86400
# Signature expiry configuration
# Chain ID enforced by the verifier (must match CHAIN_ID)
EXPECTED_CHAIN_ID=84532
# Reject legacy v1 authorization by default. Set to 1 only for an explicit rollback window.
MIN_AUTHORIZATION_VERSION=2
# Signature expiry window in seconds (default: 300 = 5 minutes)
SIGNATURE_EXPIRY_SECONDS=300
# Grace period for client clock skew in seconds (default: 60 seconds)
SIGNATURE_CLOCK_SKEW_SECONDS=60
# Verifier nonce replay store: "redis" for Docker/production (default), "memory" for local single-process
VERIFIER_NONCE_STORE=redis
VERIFIER_NONCE_KEY_PREFIX=microai:verifier:nonce:
VERIFIER_REDIS_TIMEOUT_MS=2000
# Service URLs (for Docker/production)
VERIFIER_URL=http://127.0.0.1:3002
# Required trusted public gateway origin used in request-bound authorization.
# Set only the origin (scheme + host + optional port), with no path/query/fragment.
PAYGATE_AUDIENCE=http://localhost:3000
# Maximum allowed request body size in bytes for verifier
# Default: 1048576 (1MB)
MAX_REQUEST_BODY_BYTES=1048576
# Comma-separated frontend origins allowed by the gateway CORS middleware.
# Use origins only, with no path/query/fragment.
# Defaults to http://localhost:3001 when unset or blank.
ALLOWED_ORIGINS=http://localhost:3001
# Comma-separated trusted proxy CIDRs/IPs for production deployments.
# Leave blank locally so Gin ignores X-Forwarded-For from untrusted clients.
TRUSTED_PROXIES=
# Rate Limiting
RATE_LIMIT_ENABLED=true
# Anonymous users (IP-based, no signature)
RATE_LIMIT_ANONYMOUS_BURST=5 # max burst tokens
RATE_LIMIT_ANONYMOUS_RPM=10 # requests per minute
# Standard users (signed requests)
RATE_LIMIT_STANDARD_BURST=20
RATE_LIMIT_STANDARD_RPM=60
# Verified users (future: premium tier)
RATE_LIMIT_VERIFIED_BURST=50
RATE_LIMIT_VERIFIED_RPM=120
# Cleanup interval for stale buckets (seconds)
RATE_LIMIT_CLEANUP_INTERVAL=300
# Request Timeout Configuration
# Global request timeout (seconds)
REQUEST_TIMEOUT_SECONDS=60
# AI endpoint timeout (seconds)
AI_REQUEST_TIMEOUT_SECONDS=30
# Verifier service timeout (seconds)
VERIFIER_TIMEOUT_SECONDS=2
# Health check timeout (seconds)
HEALTH_CHECK_TIMEOUT_SECONDS=2
# Metrics / Observability
# Enable the gateway Prometheus endpoint (default: true)
METRICS_ENABLED=true
# Gateway Prometheus endpoint path (default: /metrics)
METRICS_PATH=/metrics
# Redis Configuration (for Caching, Redis-backed Receipts, and verifier nonce storage)
# Use 'redis:6379' for docker-compose, 'localhost:6379' for local run
# REQUIRED when CACHE_ENABLED=true, RECEIPT_STORE=redis, or VERIFIER_NONCE_STORE=redis
REDIS_URL=redis:6379
REDIS_PASSWORD=
REDIS_DB=0
# Cache Settings
# Disabled by default so optional response cache writes cannot exhaust the
# receipt Redis instance. Enable only with dedicated cache capacity.
CACHE_ENABLED=false
# Time-to-live for cached items in seconds (default: 3600 = 1 hour)
CACHE_TTL_SECONDS=3600
# Frontend (Next.js / web/) — all read at build time, prefixed NEXT_PUBLIC_
# Verifier warm-up endpoint used by frontend banner
# Default: unset (set this to let the banner warm the verifier too)
# NEXT_PUBLIC_VERIFIER_URL=https://<verifier-app>.onrender.com
# Gateway URL the browser hits for /api/ai/summarize and /api/receipts/:id
# NEXT_PUBLIC_GATEWAY_URL=http://localhost:3000
# Chain ID the wallet widget expects (must match the gateway CHAIN_ID).
# Default 84532 (Base Sepolia).
# NEXT_PUBLIC_EXPECTED_CHAIN_ID=84532
# Display name for the expected chain — used by the wallet widget's
# "Switch to <name>" button + the summarize form placeholder copy.
# NEXT_PUBLIC_EXPECTED_CHAIN_NAME=Base Sepolia
# Pre-challenge fee label displayed under the summarize form. Informational
# only — the actual signed amount comes from the gateway's payment context.
# Default 0.001 / USDC.
# NEXT_PUBLIC_PAYMENT_AMOUNT=0.001
# NEXT_PUBLIC_PAYMENT_TOKEN=USDC
# PostHog Phase 1 browser analytics. Leave disabled locally unless you want
# event capture during manual testing.
# NEXT_PUBLIC_POSTHOG_ENABLED=false
# NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN=phc_your_project_token
# NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com