mirror of
https://github.com/mileswolfallen2/miles-web.git
synced 2026-12-04 07:47:48 +00:00
Add comprehensive test suite for application functionality
- Implement tests for HTTP API endpoints, ensuring correct responses and security headers. - Create configuration tests to validate loading of defaults and environment overrides. - Add tests for FEDL service to verify data handling and snapshot functionality. - Introduce GitHub service tests to check API data normalization and caching behavior. - Develop monitor service tests for network checks and uptime calculations. - Implement persistence tests to ensure database migrations are idempotent and data persists across restarts. - Add vault service tests for session management and brute-force protection mechanisms. - Include helper functions for test context creation and JSON response handling.
This commit is contained in:
1 parent
84b7a7e302
commit
c250653961
55 files changed
+8174
-226
No files matched your search
+134
@@ -0,0 +1,134 @@
|
||||
# milesallen.site dashboard — environment template
|
||||
#
|
||||
# Copy this file to .env for local development or deployment, then edit it.
|
||||
# Never commit .env. .env is gitignored; this template is not.
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Runtime
|
||||
# ---------------------------------------------------------------------------
|
||||
# Use "production" on a public server. Production requires SESSION_SECRET,
|
||||
# enables Secure cookies by default, and adds HSTS.
|
||||
NODE_ENV=production
|
||||
|
||||
# Bind to loopback when Caddy/Cloudflare Tunnel is in front of the app.
|
||||
# Use 0.0.0.0 only if you intentionally expose the Node server directly.
|
||||
HOST=127.0.0.1
|
||||
PORT=8787
|
||||
|
||||
# The canonical browser origin. Also used as the default CORS origin.
|
||||
PUBLIC_ORIGIN=https://milesallen.site
|
||||
|
||||
# Extra cross-origin origins, comma-separated. https://milesallen.site and
|
||||
# https://www.milesallen.site are always allowed. Same-origin requests from the
|
||||
# browser's current host are also accepted.
|
||||
# ALLOWED_ORIGINS=https://milesallen.site,https://www.milesallen.site
|
||||
|
||||
# Set true only when a trusted reverse proxy (Caddy, Cloudflare Tunnel) sets
|
||||
# CF-Connecting-IP or X-Forwarded-For. Never enable this on a direct public
|
||||
# listener, because clients could spoof their IP and bypass rate limits.
|
||||
TRUST_PROXY=true
|
||||
|
||||
# Where the static site lives. Defaults to the process working directory.
|
||||
# SITE_ROOT=/opt/miles-web
|
||||
|
||||
# SQLite file. Keep it outside the web root if you serve files with another
|
||||
# web server. The Node app already blocks /data and /server.
|
||||
DB_PATH=/var/lib/miles-dashboard/dashboard.db
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Sessions and Moon Vault
|
||||
# ---------------------------------------------------------------------------
|
||||
# Generate with: openssl rand -hex 32
|
||||
# Required in production, minimum 32 characters.
|
||||
SESSION_SECRET=
|
||||
|
||||
# Generate with: npm run hash-password -- "your long passphrase"
|
||||
# Prefer this over VAULT_PASSWORD. The hash is Argon2id, never the passphrase.
|
||||
VAULT_PASSWORD_HASH=
|
||||
|
||||
# Optional local-only convenience. Prefer VAULT_PASSWORD_HASH in production.
|
||||
# VAULT_PASSWORD=
|
||||
|
||||
# Session lifetime in hours (1–720).
|
||||
VAULT_SESSION_HOURS=12
|
||||
|
||||
# Failed attempts allowed per IP hash before temporary lockout.
|
||||
VAULT_MAX_ATTEMPTS=5
|
||||
VAULT_ATTEMPT_WINDOW_MINUTES=15
|
||||
|
||||
VAULT_COOKIE_NAME=miles_vault
|
||||
|
||||
# Defaults to true in production and false in development. Keep true on HTTPS.
|
||||
# COOKIE_SECURE=true
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# GitHub (server-side official REST API only)
|
||||
# ---------------------------------------------------------------------------
|
||||
GITHUB_USERNAME=mileswolfallen2
|
||||
|
||||
# A classic token with no scopes is enough for public data and raises the rate
|
||||
# limit. The token is only used server-side and is never sent to the browser.
|
||||
GITHUB_TOKEN=
|
||||
GITHUB_ENRICH=false
|
||||
GITHUB_REFRESH_MS=1800000
|
||||
GITHUB_TIMEOUT_MS=10000
|
||||
GITHUB_API_BASE=https://api.github.com
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# FEDL (real public API only)
|
||||
# ---------------------------------------------------------------------------
|
||||
FEDL_API_BASE=https://server.fedl.site/fedl/api
|
||||
FEDL_SITE_URL=https://fedl.site
|
||||
FEDL_REFRESH_MS=900000
|
||||
FEDL_TIMEOUT_MS=15000
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Monitoring
|
||||
# ---------------------------------------------------------------------------
|
||||
# Used to decide whether this machine is on the home LAN. When it is not,
|
||||
# failed home-server pings are reported as "unknown" instead of "offline".
|
||||
HOME_SUBNET=10.0.0.0/24
|
||||
|
||||
SERVER_CHECK_INTERVAL_MS=60000
|
||||
SERVICE_CHECK_INTERVAL_MS=120000
|
||||
PING_TIMEOUT_MS=2000
|
||||
HTTP_CHECK_TIMEOUT_MS=5000
|
||||
MONITOR_RETENTION_DAYS=90
|
||||
|
||||
# The server list lives in server/config/servers.json. Environment overrides:
|
||||
# SERVER_1_NAME=Home Server 1
|
||||
# SERVER_1_IP=10.0.0.87
|
||||
# SERVER_1_ENABLED=true
|
||||
# SERVER_2_NAME=Home Server 2
|
||||
# SERVER_2_IP=10.0.0.119
|
||||
# SERVER_2_ENABLED=true
|
||||
|
||||
# The website list lives in server/config/services.json. Override a check URL
|
||||
# by id (uppercase, non-alphanumerics become underscores):
|
||||
# SERVICE_FEDL_URL=https://fedl.site/
|
||||
# SERVICE_FEDL_ENABLED=true
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Analytics (privacy-friendly)
|
||||
# ---------------------------------------------------------------------------
|
||||
ANALYTICS_RETENTION_DAYS=30
|
||||
ANALYTICS_DEDUPE_SECONDS=10
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Limits and logging
|
||||
# ---------------------------------------------------------------------------
|
||||
API_RATE_LIMIT=300
|
||||
ANALYTICS_RATE_LIMIT=120
|
||||
LOGIN_RATE_LIMIT=15
|
||||
REQUEST_TIMEOUT_MS=30000
|
||||
BODY_LIMIT_BYTES=16384
|
||||
|
||||
# debug | info | warn | error
|
||||
LOG_LEVEL=info
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Optional registry path overrides
|
||||
# ---------------------------------------------------------------------------
|
||||
# PROJECTS_CONFIG_PATH=/opt/miles-web/server/config/projects.json
|
||||
# SERVICES_CONFIG_PATH=/opt/miles-web/server/config/services.json
|
||||
# SERVERS_CONFIG_PATH=/opt/miles-web/server/config/servers.json
|
||||
Reference in new issue
Block a user