blob: ff2a50229c3183ee466b506f6c0b185d94ee7140 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#!/bin/bash
# get all available configs from /etc/netbird/*.json directory
# user can override the config folder by setting NETBIRD_CONFIG_FOLDER
CONFIG_FOLDER=${NETBIRD_CONFIG_FOLDER:-/etc/netbird}
# check if the config folder exists
if [ ! -d "$CONFIG_FOLDER" ]; then
echo "Warning: Config folder $CONFIG_FOLDER does not exist, exiting early..." >&2
exit 0
fi
for file in "$CONFIG_FOLDER"/*.json; do
if [ -f "$file" ]; then
# get name of the file without the extension
filename=$(basename "$file" .json)
command_name="netbird-$filename"
alias $command_name="/usr/bin/netbird --daemon-addr unix:///var/run/netbird-$filename.sock"
fi
done
alias "netbird"="echo 'You are using a multi-config setup. Please use the config name as a command, e.g. netbird-<config_name>.'"
|