Files
p2ns/default.env
T
2026-05-30 22:27:42 -04:00

156 lines
6.7 KiB
Bash

# ============================================================================
# Storage and File Paths
# ============================================================================
STORAGE_DIR=./my-storage
DOMAINS_FILE=cache/domains.json
LOCAL_DNS_FILE=cache/local_dns.json
HOLESAIL_SERVERS_FILE=cache/holesail_servers.json
HOLESAIL_CLIENTS_FILE=cache/holesail_clients.json
SELECTOR_CACHE_FILE=cache/selector_cache.json
SUBSCRIPTIONS_FILE=cache/subscriptions.json
PEER_HISTORY_FILE=cache/peer_history.json
CERTS_DIR=./certs
BACKUP_DIR=./backups
# ============================================================================
# Network Configuration
# ============================================================================
# Ports
DNS_PORT=53
HTTP_PORT=80
HTTPS_PORT=443
INTERNAL_PORT=8080
PORT_CHECK_TIMEOUT=2
# Hyperswarm Configuration
# Maximum number of peer connections (default: 24)
MAX_PEERS=24
# Connection timeout in milliseconds for swarm connections (default: 30000 = 30 seconds)
# Increase this value if local network peers are timing out
SWARM_CONNECTION_TIMEOUT=30000
# Keep-alive interval in milliseconds to rejoin swarm topic (default: 60000 = 60 seconds)
# This ensures the node stays connected to the swarm/DHT network
# Set to 0 to disable keep-alive (not recommended for master nodes)
SWARM_KEEPALIVE_INTERVAL=60000
# Channel keep-alive interval in milliseconds for plugin channels (default: 30000 = 30 seconds)
# Sends heartbeat pings to detect stale channels and trigger reconnection
# Set to 0 to disable channel keep-alive
CHANNEL_KEEPALIVE_INTERVAL=30000
# Channel keep-alive timeout in milliseconds (default: 10000 = 10 seconds)
# If no pong is received within this time, the channel is marked stale and recreated
CHANNEL_KEEPALIVE_TIMEOUT=10000
# DNS
# Public DNS server(s) - supports comma-separated list for failover
# Example: PUBLIC_DNS_SERVER=1.1.1.1,8.8.8.8,9.9.9.9
PUBLIC_DNS_SERVER=1.1.1.1
# Note: Internal domains are now automatically discovered from plugin-sites/{domain}/config.json files
# p2ns.admin is always treated as an internal domain
# Subnets (Virtual Interface IP Allocation)
SUBNET_BASE=192.168.3.
INITIAL_IP_INDEX=2
SUBNET_NAME=
SUBNETS=[{"base":"192.168.3.0","cidr":24,"startIndex":2,"name":"Primary Subnet"},{"base":"10.0.0.0","cidr":24,"startIndex":2,"name":"Secondary Subnet"}]
# ============================================================================
# Holesail Configuration
# ============================================================================
HOLESAIL_TIMEOUT=5
FULL_PERSISTENCE=false
# ============================================================================
# Consensus Configuration
# ============================================================================
CONSENSUS_QUORUM_THRESHOLD=0.5
CONSENSUS_MIN_VOTES=2
CONSENSUS_TIE_BREAKER=timestamp
CONSENSUS_VOTE_VALIDATION=true
CONSENSUS_IMMEDIATE_UPDATE=true
# ============================================================================
# Feature Flags
# ============================================================================
DISABLE_DNS_SERVER=false
DISABLE_PROXY_SERVER=false
DISABLE_VIRTUAL_INTERFACES=false
ALLOW_ANY_WRITER_INVITES=true
# Enable shared Corestore namespaces for plugin databases (default: enabled)
# Set to false to force plugin-local Corestore storage.
USE_SHARED_CORESTORE_NAMESPACES=true
# Protomux RPC is required for core invite/consensus and plugin channels (always on).
# Enable hypercore/corestore stats collection for /api/stats (default: enabled)
# Set to false to disable holepunch stats collection.
ENABLE_HYPERCORE_STATS=true
# ============================================================================
# Logging
# ============================================================================
# 0=DEBUG, 1=INFO, 2=WARN, 3=ERROR
LOG_LEVEL=1
# Split log files directory (core.log, proxy.log, http-proxy.log, dns.log, plugins.log, holesail.log)
# LOG_DIR=./logs
# In-memory tail lines per channel for admin /api/logs and WebSocket tail
# LOG_BUFFER_LINES=2000
# ============================================================================
# Backup Configuration
# ============================================================================
BACKUP_RETENTION=25
BACKUP_INTERVAL=720
# ============================================================================
# Metrics Configuration
# ============================================================================
METRICS_RETENTION_MS=60
METRICS_SAMPLING_RATE=1.0
METRICS_AGGREGATION_INTERVAL=60
METRICS_MAX_BUFFER_SIZE=1000
# ============================================================================
# P2P Network Configuration
# ============================================================================
TOPIC_SEED=p2ns-dns
# ============================================================================
# Master Node Configuration
# ============================================================================
# Master mode: pass --master on the command line OR set P2NS_MASTER=true (for Docker/PM2).
# Genesis (create network): --master --genesis OR P2NS_GENESIS=true (once per network).
# Secondary masters: --master only (empty storage pairs via invite; do not use --genesis).
# P2NS_MASTER=true
# P2NS_GENESIS=true
# NETWORK_MANIFEST_FILE=cache/network.json
# MASTER_LOAD_DOMAINS=false
# MASTER_INVITE_ONLY=false
# These settings only apply in master mode
# Base interval in seconds for reconnection attempts when peers disconnect (default: 5)
# Master nodes will attempt to reconnect to disconnected peers with exponential backoff
MASTER_RECONNECT_INTERVAL=5
# Maximum number of reconnection attempts per peer before giving up (default: 10)
MASTER_MAX_RECONNECT_ATTEMPTS=10
# Delay in milliseconds before sending proactive invite to new peers (default: 2000)
# Master nodes automatically send invites to peers when they connect
MASTER_PROACTIVE_INVITE_DELAY=2000
# Timeout for Autopass createInvite including member.flushed() (default: 20000ms)
# CREATE_INVITE_TIMEOUT_MS=20000
# Autopass replication is handled by Autopass's own swarm; p2ns topic does not replicate dnsPass
# MASTER_REPLICATE_DELAY is intentionally unused for dnsPass replication.
# Gap between serialized Autopass ops in ms (default: 50)
# DNS_PASS_OP_GAP_MS=50
# ============================================================================
# Shutdown / Cleanup
# ============================================================================
# SHUTDOWN_MODE=fast — shorter timeouts, skip port-release waits (dev/restart)
# SHUTDOWN_MODE=fast
# SHUTDOWN_SERVER_TIMEOUT_MS=5000
# SHUTDOWN_SETTLE_MS=2000
# SHUTDOWN_REPLICATION_SETTLE_MS=5000
# SHUTDOWN_HOLESAIL_CHILD_GRACE_MS=10000
# SHUTDOWN_HOLESAIL_CHILD_KILL_MS=5000
# SHUTDOWN_INVITE_TIMEOUT_MS=5000
# SHUTDOWN_HOLESAIL_UDP_CLOSE_MS=5000
# SHUTDOWN_SKIP_PORT_WAIT=true