Backend: - Add configurable draw cycle settings (minutes/hourly/daily/weekly/custom) - Add CYCLE_TYPE, CYCLE_INTERVAL_*, CYCLE_DAILY_TIME, CYCLE_WEEKLY_* env vars - Add SALES_CLOSE_BEFORE_DRAW_MINUTES and CYCLES_TO_GENERATE_AHEAD - Fix SQLite parameter issue in scheduler Frontend: - Add 'Save This Link' section with copy button on ticket status page - Improve draw animation to show immediately when draw starts - Show 'Waiting for next round...' instead of 'Drawing Now!' after draw - Hide Buy Tickets button when waiting for next round - Skip draw animation if no tickets were sold - Keep winner screen open longer (15s) for next cycle to load - Auto-refresh to next lottery cycle after draw Telegram Bot: - Various improvements and fixes
125 lines
3.8 KiB
Plaintext
125 lines
3.8 KiB
Plaintext
# Lightning Lottery Backend - Environment Configuration
|
|
# Copy this file to .env and fill in your values
|
|
|
|
# ======================
|
|
# Server Configuration
|
|
# ======================
|
|
PORT=3000
|
|
APP_BASE_URL=http://localhost:3000
|
|
FRONTEND_BASE_URL=http://localhost:3001
|
|
# Optional: comma-separated list to override allowed origins
|
|
# CORS_ALLOWED_ORIGINS=http://localhost:3001,https://app.yourdomain.com
|
|
NODE_ENV=development
|
|
|
|
# ======================
|
|
# Database Configuration
|
|
# ======================
|
|
# Database type: "postgres" or "sqlite"
|
|
DATABASE_TYPE=sqlite
|
|
|
|
# Database connection
|
|
# For PostgreSQL: postgresql://username:password@host:port/database
|
|
# For SQLite: ./data/lightning_lotto.db (relative path)
|
|
DATABASE_URL=./data/lightning_lotto.db
|
|
|
|
# PostgreSQL example:
|
|
# DATABASE_TYPE=postgres
|
|
# DATABASE_URL=postgresql://user:password@localhost:5432/lightning_lotto
|
|
|
|
# ======================
|
|
# LNbits Configuration
|
|
# ======================
|
|
# Your LNbits instance URL
|
|
LNBITS_API_BASE_URL=https://legend.lnbits.com
|
|
|
|
# LNbits admin/invoice key (required for creating invoices and payouts)
|
|
# Get this from your LNbits wallet settings
|
|
LNBITS_ADMIN_KEY=your_lnbits_admin_key_here
|
|
|
|
# Webhook secret for validating LNbits payment notifications
|
|
# Choose a random secret string
|
|
LNBITS_WEBHOOK_SECRET=your_webhook_secret_here
|
|
|
|
# ======================
|
|
# Security Configuration
|
|
# ======================
|
|
# Secret for signing JWT tokens (use a strong random string)
|
|
# Generate with: openssl rand -hex 32
|
|
JWT_SECRET=your_jwt_secret_here_change_in_production
|
|
|
|
# Admin API key for admin endpoints
|
|
# Generate with: openssl rand -hex 32
|
|
ADMIN_API_KEY=your_admin_api_key_here_change_in_production
|
|
|
|
# ======================
|
|
# Scheduler Configuration
|
|
# ======================
|
|
# How often to check for draws that need to be executed (in seconds)
|
|
DRAW_SCHEDULER_INTERVAL_SECONDS=60
|
|
|
|
# How often to generate future cycles (in seconds)
|
|
CYCLE_GENERATOR_INTERVAL_SECONDS=300
|
|
|
|
# ======================
|
|
# Lottery Configuration
|
|
# ======================
|
|
# Default ticket price in satoshis
|
|
DEFAULT_TICKET_PRICE_SATS=1000
|
|
|
|
# House fee percentage (0-100)
|
|
# Example: 5 means 5% fee, winner gets 95% of pot
|
|
DEFAULT_HOUSE_FEE_PERCENT=5
|
|
|
|
# Maximum Lightning payout attempts before drawing a new winner
|
|
PAYOUT_MAX_ATTEMPTS=2
|
|
|
|
# ======================
|
|
# Draw Cycle Configuration
|
|
# ======================
|
|
# Cycle type: "minutes" | "hourly" | "daily" | "weekly" | "custom"
|
|
CYCLE_TYPE=hourly
|
|
|
|
# ---- For MINUTES cycle ----
|
|
# Draw every X minutes (e.g., 30 = every 30 minutes)
|
|
CYCLE_INTERVAL_MINUTES=60
|
|
|
|
# ---- For HOURLY cycle ----
|
|
# Draw every X hours (e.g., 1 = every hour, 4 = every 4 hours)
|
|
CYCLE_INTERVAL_HOURS=1
|
|
|
|
# ---- For DAILY cycle ----
|
|
# Draw time in 24-hour format (HH:MM in UTC)
|
|
# Example: 18:00 = 6 PM UTC
|
|
CYCLE_DAILY_TIME=18:00
|
|
|
|
# ---- For WEEKLY cycle ----
|
|
# Day of week: 0=Sunday, 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday
|
|
CYCLE_WEEKLY_DAY=6
|
|
# Draw time in 24-hour format (HH:MM in UTC)
|
|
CYCLE_WEEKLY_TIME=20:00
|
|
|
|
# ---- For CUSTOM cycle (advanced) ----
|
|
# Cron expression for custom schedules
|
|
# Format: "minute hour day-of-month month day-of-week"
|
|
# Example: "0 */4 * * *" = every 4 hours
|
|
# Example: "0 20 * * 6" = every Saturday at 8 PM
|
|
# Example: "30 12,18 * * *" = 12:30 PM and 6:30 PM daily
|
|
CYCLE_CRON_EXPRESSION=0 * * * *
|
|
|
|
# ---- Sales Window ----
|
|
# How many minutes before the draw to stop accepting tickets
|
|
SALES_CLOSE_BEFORE_DRAW_MINUTES=5
|
|
|
|
# How many cycles to pre-generate in advance
|
|
CYCLES_TO_GENERATE_AHEAD=5
|
|
|
|
# ======================
|
|
# Notes
|
|
# ======================
|
|
# - SQLite is perfect for development and testing (no setup required!)
|
|
# - Use PostgreSQL for production deployments
|
|
# - Never commit the actual .env file to version control
|
|
# - Use strong, unique secrets in production
|
|
# - Keep your LNbits keys secure
|
|
# - Test with small amounts first
|