Skip to content

Commit b17eeca

Browse files
feat: better domain filtering
1 parent d2f2909 commit b17eeca

2 files changed

Lines changed: 49 additions & 10 deletions

File tree

README.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,25 @@ This webhook provider allows Kubernetes external-dns to automatically create, up
4141
SSH into your Firewalla as the `pi` user and run:
4242

4343
```bash
44-
curl -fsSL https://raw.githubusercontent.com/TheOutdoorProgrammer/external-dns-firewalla-webhook/main/scripts/install.sh | bash
44+
curl -fsSL https://raw.githubusercontent.com/TheOutdoorProgrammer/external-dns-firewalla-webhook/main/scripts/install.sh | bash -s -- "home.local,*.home.local"
4545
```
4646

47+
**Important**: Replace `home.local,*.home.local` with your actual domain filter.
48+
4749
**Note**: The script will prompt for your sudo password when needed for system configuration.
4850

4951
This will:
5052
- Clone the repository (with bundled dependencies)
5153
- Verify dependencies
5254
- Configure the service (with sudo)
53-
- Prompt for your domain filter
55+
- Set up your domain filter
5456
- Start the webhook provider
5557

5658
**Note**: Dependencies (Express.js) are bundled in the repository since npm is not available on Firewalla.
5759

58-
### Manual Installation
60+
### Interactive Installation
5961

60-
If you prefer to review the installation script first:
62+
If you prefer an interactive installation that prompts for configuration:
6163

6264
1. SSH into your Firewalla device as the `pi` user:
6365
```bash
@@ -70,7 +72,7 @@ If you prefer to review the installation script first:
7072
cd external-dns-firewalla-webhook
7173
```
7274

73-
3. Review the installation script:
75+
3. Review the installation script (optional):
7476
```bash
7577
cat scripts/install.sh
7678
```
@@ -80,15 +82,23 @@ If you prefer to review the installation script first:
8082
./scripts/install.sh
8183
```
8284

83-
The script will ask for your sudo password when needed.
85+
The script will ask for your sudo password and domain filter when needed.
8486

85-
5. Follow the prompts to configure your domain filter (e.g., `home.local,*.home.local`)
87+
5. Enter your domain filter when prompted (e.g., `home.local,*.home.local`)
8688

8789
6. Verify the service is running:
8890
```bash
8991
sudo systemctl status external-dns-firewalla-webhook
9092
```
9193

94+
### Alternative: Pass Domain Filter as Argument
95+
96+
You can also provide the domain filter directly:
97+
98+
```bash
99+
./scripts/install.sh "home.local,*.home.local"
100+
```
101+
92102
### Configuration in Kubernetes
93103

94104
#### Using Helm Chart (Recommended)

scripts/install.sh

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
# Installation script for External-DNS Firewalla Webhook Provider
44
# This script installs and configures the webhook provider on Firewalla
55
#
6+
# Usage:
7+
# ./scripts/install.sh [domain-filter]
8+
# curl -fsSL https://raw.githubusercontent.com/.../install.sh | bash -s -- "example.com,*.example.com"
9+
#
610
set -e
711

812
# Colors for output
@@ -11,6 +15,9 @@ GREEN='\033[0;32m'
1115
YELLOW='\033[1;33m'
1216
NC='\033[0m' # No Color
1317

18+
# Get domain filter from first argument if provided
19+
DOMAIN_FILTER="${1:-}"
20+
1421
# Configuration
1522
INSTALL_DIR="/opt/external-dns-firewalla-webhook"
1623
SERVICE_NAME="external-dns-firewalla-webhook"
@@ -117,9 +124,31 @@ echo "Dependencies verified (bundled in repository)"
117124
# Configure environment
118125
echo -e "${GREEN}[6/9]${NC} Configuring environment..."
119126
if [ ! -s "$INSTALL_DIR/.env" ] || ! grep -q "DOMAIN_FILTER=" "$INSTALL_DIR/.env" || grep -q "DOMAIN_FILTER=example.com" "$INSTALL_DIR/.env"; then
120-
echo ""
121-
echo -e "${YELLOW}Please enter your domain filter (comma-separated, e.g., example.com,*.example.com):${NC}"
122-
read -p "Domain filter: " DOMAIN_FILTER
127+
# If domain filter not provided as argument, try to read from stdin
128+
if [ -z "$DOMAIN_FILTER" ]; then
129+
# Check if stdin is a terminal (interactive)
130+
if [ -t 0 ]; then
131+
echo ""
132+
echo -e "${YELLOW}Please enter your domain filter (comma-separated, e.g., example.com,*.example.com):${NC}"
133+
read -p "Domain filter: " DOMAIN_FILTER
134+
else
135+
# Not interactive (piped from curl)
136+
echo ""
137+
echo -e "${RED}ERROR: Domain filter is required but not provided${NC}"
138+
echo ""
139+
echo "When using the one-line install, provide your domain filter as an argument:"
140+
echo ""
141+
echo " curl -fsSL https://raw.githubusercontent.com/.../install.sh | bash -s -- \"example.com,*.example.com\""
142+
echo ""
143+
echo "Alternatively, run the installation interactively:"
144+
echo ""
145+
echo " git clone $GITHUB_REPO"
146+
echo " cd external-dns-firewalla-webhook"
147+
echo " ./scripts/install.sh"
148+
echo ""
149+
exit 1
150+
fi
151+
fi
123152

124153
if [ -z "$DOMAIN_FILTER" ]; then
125154
echo -e "${RED}ERROR: Domain filter cannot be empty${NC}"

0 commit comments

Comments
 (0)