From dbdecda03f6c30c47f25fec18755f3a3d3370634 Mon Sep 17 00:00:00 2001 From: Nebulosa <85841412+nebulosa2007@users.noreply.github.com> Date: Fri, 3 Jul 2026 01:28:13 +0300 Subject: [PATCH] Env vars example file update (#5678) * Update .env.example * Update .env.example * Update .env.example * Update .env.example --- .env.example | 184 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 171 insertions(+), 13 deletions(-) diff --git a/.env.example b/.env.example index 8c8f02429..29d483ac3 100644 --- a/.env.example +++ b/.env.example @@ -1,19 +1,177 @@ +# This file serves a dual purpose: +# 1. Developer Bootstrap: The active (uncommented) variables directly below +# configure a safe, unprivileged local environment for 'go run .'. +# This allows 'cp .env.example .env' to work out-of-the-box without root. +# 2. Production Reference: All available XUI_* configuration options are +# documented and commented out in the reference section further below. +# +# 3x-ui reads its runtime configuration from XUI_* environment variables. +# On a script install, the installer writes them to the service environment file +# (/etc/default/x-ui, /etc/conf.d/x-ui, or /etc/sysconfig/x-ui depending on the distro). +# For Docker, you set them in docker-compose.yml or via 'docker run -e'. +# +# Defaults are sensible — set only what you need to change, then restart: +# systemctl restart x-ui + +# ------------------------------------------------------------------------------ +# LOCAL DEVELOPMENT OVERRIDES (ACTIVE BY DEFAULT) +# ------------------------------------------------------------------------------ XUI_DEBUG=true XUI_DB_FOLDER=x-ui XUI_LOG_FOLDER=x-ui XUI_BIN_FOLDER=x-ui XUI_INIT_WEB_BASE_PATH=/ -# XUI_PORT=8080 -# Optional tunnel health monitor (disabled by default). It periodically probes a -# URL and restarts xray-core after repeated failures. Point XUI_TUNNEL_HEALTH_PROXY -# at a local xray inbound so the probe tests the tunnel; without it the probe only -# checks host connectivity and a restart will not fix host network issues. A restart -# drops every connected client. -# XUI_TUNNEL_HEALTH_MONITOR=true -# XUI_TUNNEL_HEALTH_PROXY=socks5://127.0.0.1:1080 -# XUI_TUNNEL_HEALTH_URL=https://www.cloudflare.com/cdn-cgi/trace -# XUI_TUNNEL_HEALTH_INTERVAL=30s -# XUI_TUNNEL_HEALTH_TIMEOUT=10s -# XUI_TUNNEL_HEALTH_FAILURES=3 -# XUI_TUNNEL_HEALTH_COOLDOWN=5m +# ============================================================================== +# REFERENCE CONFIGURATION (ALL OPTIONS) +# ============================================================================== + +# ------------------------------------------------------------------------------ +# Database +# ------------------------------------------------------------------------------ +# Backend database type: sqlite, or postgres (also accepts postgresql / pg) +# Default: sqlite +#XUI_DB_TYPE=sqlite + +# Folder for the SQLite database file (x-ui.db) +# Default: /etc/x-ui (Overridden to 'x-ui' in the development block above) +#XUI_DB_FOLDER=/etc/x-ui + +# PostgreSQL connection string (used when XUI_DB_TYPE=postgres) +# Example: postgres://user:password@localhost:5432/dbname?sslmode=disable +#XUI_DB_DSN= + +# Max open connections in the PostgreSQL pool +#XUI_DB_MAX_OPEN_CONNS= + +# Max idle connections in the PostgreSQL pool +#XUI_DB_MAX_IDLE_CONNS= + +# PostgreSQL Docker Container Settings +# Default credentials used if you are running PostgreSQL via docker-compose +#POSTGRES_USER=xui +#POSTGRES_PASSWORD=xui +#POSTGRES_DB=xui + + +# ------------------------------------------------------------------------------ +# Panel +# ------------------------------------------------------------------------------ +# Override the panel port (1–65535). Takes precedence over the stored setting. +#XUI_PORT= + +# Initial web base path on FIRST launch (e.g., /panel) +# Default: / +#XUI_INIT_WEB_BASE_PATH=/ + +# Enable Fail2ban-based IP-limit enforcement +# Default: true +#XUI_ENABLE_FAIL2BAN=true + +# Skip the HSTS header — set true when TLS is terminated by a reverse proxy +# Default: false +#XUI_SKIP_HSTS=false + + +# ------------------------------------------------------------------------------ +# Logging & binaries +# ------------------------------------------------------------------------------ +# Logging level: debug, info, notice, warning, or error +# Default: info +#XUI_LOG_LEVEL=info + +# Debug mode. Forces log level to debug, enables Gin debug mode, +# and ensures frontend assets are served directly from disk (see CLAUDE.md). +# Default: false (Overridden to 'true' in the development block at the top) +#XUI_DEBUG=false + +# Log output directory +# Default: /var/log/x-ui (Overridden to 'x-ui' in the development block above) +#XUI_LOG_FOLDER=/var/log/x-ui + +# Folder for the Xray-core binary and geosite/geoip files +# Default: bin (Overridden to 'x-ui' in the development block above) +#XUI_BIN_FOLDER=bin + +# Legacy Path Settings +# Main installation folder (Default: /usr/local/x-ui for Linux, /app for Docker) +#XUI_MAIN_FOLDER=/usr/local/x-ui +# Path to the systemd service file (Default: /etc/systemd/system) +#XUI_SERVICE=/etc/systemd/system + + +# ------------------------------------------------------------------------------ +# Memory & profiling +# ------------------------------------------------------------------------------ +# Go GC target percentage; lower = less RAM, slightly more CPU. +# Default: 75 +#XUI_GOGC= + +# Minutes between FreeOSMemory calls; 0 disables. +# Default: 10 +#XUI_MEMORY_RELEASE_INTERVAL= + +# Go soft memory limit in MiB +#XUI_MEMORY_LIMIT= + +# Go-syntax soft limit (e.g., 400MiB); takes precedence over XUI_MEMORY_LIMIT +#GOMEMLIMIT= + +# Expose pprof profiling on 127.0.0.1:6060 +# Default: false +#XUI_PPROF=false + +# Automatically set to 'true' inside the official Docker image. +# Consumed by internal scripts (x-ui.sh) to detect the environment. +# There is normally no need to set or toggle this variable manually. +# Default: false (automatically 'true' in Docker environments) +#XUI_IN_DOCKER=false + + +# ------------------------------------------------------------------------------ +# Xray +# ------------------------------------------------------------------------------ +# Force VMess AEAD +# Default: false +#XRAY_VMESS_AEAD_FORCED=false + + +# ------------------------------------------------------------------------------ +# Tunnel health monitor +# ------------------------------------------------------------------------------ +# Optional watchdog: probes a URL (optionally through a local Xray inbound) +# and restarts Xray after repeated failures. A restart drops all connected clients. +# Default: false +#XUI_TUNNEL_HEALTH_MONITOR=false + +# Proxy to send the probe through, e.g., socks5://127.0.0.1:1080 +# Empty = only checks host connectivity +#XUI_TUNNEL_HEALTH_PROXY= + +# URL to probe +# Default: https://www.cloudflare.com/cdn-cgi/trace +#XUI_TUNNEL_HEALTH_URL=https://www.cloudflare.com/cdn-cgi/trace + +# Interval between probes +# Default: 30s +#XUI_TUNNEL_HEALTH_INTERVAL=30s + +# Per-probe timeout +# Default: 10s +#XUI_TUNNEL_HEALTH_TIMEOUT=10s + +# Consecutive failures before a restart +# Default: 3 +#XUI_TUNNEL_HEALTH_FAILURES=3 + +# Minimum delay between restarts +# Default: 5m +#XUI_TUNNEL_HEALTH_COOLDOWN=5m + + +# ------------------------------------------------------------------------------ +# Unattended install +# ------------------------------------------------------------------------------ +# Set to 1 (or run with no TTY) to install with zero prompts. +# Generated credentials will be written to /etc/x-ui/install-result.env +#XUI_NONINTERACTIVE=1