Browse Source

Added docker environment way to join networks (#1871)

Leonardo Amaral 2 years ago
parent
commit
c6adfd9d67
2 changed files with 12 additions and 1 deletions
  1. 1 0
      README.docker.md
  2. 11 1
      entrypoint.sh.release

+ 1 - 0
README.docker.md

@@ -60,6 +60,7 @@ To ensure you have a network available before trying to listen on it. Without pr
 
 
 You can control a few settings including the identity used and the authtoken used to interact with the control socket (which you can forward and access through `localhost:9993`).
 You can control a few settings including the identity used and the authtoken used to interact with the control socket (which you can forward and access through `localhost:9993`).
 
 
+- `ZEROTIER_JOIN_NETWORKS`: additional way to set networks to join.
 - `ZEROTIER_API_SECRET`: replaces the `authtoken.secret` before booting and allows you to manage the control socket's authentication key.
 - `ZEROTIER_API_SECRET`: replaces the `authtoken.secret` before booting and allows you to manage the control socket's authentication key.
 - `ZEROTIER_IDENTITY_PUBLIC`: the `identity.public` file for zerotier-one. Use `zerotier-idtool` to generate one of these for you.
 - `ZEROTIER_IDENTITY_PUBLIC`: the `identity.public` file for zerotier-one. Use `zerotier-idtool` to generate one of these for you.
 - `ZEROTIER_IDENTITY_SECRET`: the `identity.secret` file for zerotier-one. Use `zerotier-idtool` to generate one of these for you.
 - `ZEROTIER_IDENTITY_SECRET`: the `identity.secret` file for zerotier-one. Use `zerotier-idtool` to generate one of these for you.

+ 11 - 1
entrypoint.sh.release

@@ -71,13 +71,23 @@ trap killzerotier INT TERM
 log "Configuring networks to join"
 log "Configuring networks to join"
 mkdir -p /var/lib/zerotier-one/networks.d
 mkdir -p /var/lib/zerotier-one/networks.d
 
 
-log_params "Joining networks:" $@
+log_params "Joining networks from command line:" $@
 for i in "$@"
 for i in "$@"
 do
 do
   log_detail_params "Configuring join:" "$i"
   log_detail_params "Configuring join:" "$i"
   touch "/var/lib/zerotier-one/networks.d/${i}.conf"
   touch "/var/lib/zerotier-one/networks.d/${i}.conf"
 done
 done
 
 
+if [ "x$ZEROTIER_JOIN_NETWORKS" != "x" ]
+then
+  log_params "Joining networks from environment:" $ZEROTIER_JOIN_NETWORKS
+  for i in "$ZEROTIER_JOIN_NETWORKS"
+  do
+    log_detail_params "Configuring join:" "$i"
+    touch "/var/lib/zerotier-one/networks.d/${i}.conf"
+  done
+fi
+
 log "Starting ZeroTier"
 log "Starting ZeroTier"
 nohup /usr/sbin/zerotier-one &
 nohup /usr/sbin/zerotier-one &