Skip to content

Commit

Permalink
🚑 Fixes secret support for network IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck committed Apr 16, 2019
1 parent d3f3174 commit 656a2d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion zerotier/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"api_auth_token": ""
},
"schema": {
"networks":["match([0-9a-z]{16})"],
"networks":["match(^!secret [a-zA-Z0-9_\\-]+$|[0-9a-z]{16})"],
"api_auth_token": "str",
"log_level": "match(^(trace|debug|info|notice|warning|error|fatal)$)?"
}
Expand Down
10 changes: 8 additions & 2 deletions zerotier/rootfs/etc/cont-init.d/zerotier.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ mkdir -p "/var/lib/zerotier-one/networks.d" \

# Install user configured/requested packages
if bashio::config.has_value 'networks'; then
for network in $(bashio::config 'networks'); do
while read -r network; do
# Get network ID from secrets, if it is a secret
if bashio::is_secret "${network}"; then
network=$(bashio::secret "${network}")
fi

bashio::log.info "Configuring network: ${network}"

# Ensure the file exists. An empty file will cause automatic join.
Expand All @@ -60,5 +65,6 @@ if bashio::config.has_value 'networks'; then
"/data/network.${network}.conf" \
"/var/lib/zerotier-one/networks.d/${network}.conf" \
|| bashio::exit.nok "Could not create network file"
done
done <<< "$(bashio::config 'networks')"

fi

0 comments on commit 656a2d9

Please sign in to comment.