diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..d0181ca6 --- /dev/null +++ b/.env.example @@ -0,0 +1,4 @@ +# sing-box Xboard Node Configuration +PANEL_URL=https://your-panel.com +PANEL_TOKEN=your_node_key +NODE_ID=1 diff --git a/install.sh b/install.sh index cf5e62cb..dd97da3b 100644 --- a/install.sh +++ b/install.sh @@ -113,10 +113,21 @@ build_sing_box() { install_go build_sing_box +# Load .env if exists +if [[ -f ".env" ]]; then + echo -e "${YELLOW}Loading configuration from .env...${NC}" + source .env +fi + # Interactive Prompts -read -p "Enter Panel URL (e.g., https://yourbase.com): " PANEL_URL -read -p "Enter Node ID: " NODE_ID -read -p "Enter Panel Token (Node Key): " PANEL_TOKEN +read -p "Enter Panel URL [${PANEL_URL}]: " INPUT_URL +PANEL_URL=${INPUT_URL:-$PANEL_URL} + +read -p "Enter Node ID [${NODE_ID}]: " INPUT_ID +NODE_ID=${INPUT_ID:-$NODE_ID} + +read -p "Enter Panel Token (Node Key) [${PANEL_TOKEN}]: " INPUT_TOKEN +PANEL_TOKEN=${INPUT_TOKEN:-$PANEL_TOKEN} if [[ -z "$PANEL_URL" || -z "$NODE_ID" || -z "$PANEL_TOKEN" ]]; then echo -e "${RED}All fields are required!${NC}"