From c6adfd9d678d7726427b26b64da98064e5b81c3e Mon Sep 17 00:00:00 2001 From: Leonardo Amaral Date: Thu, 2 Mar 2023 07:18:11 -0300 Subject: [PATCH] Added docker environment way to join networks (#1871) --- README.docker.md | 1 + entrypoint.sh.release | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.docker.md b/README.docker.md index 17e3cf4b8..0410f892e 100644 --- a/README.docker.md +++ b/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`). +- `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_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. diff --git a/entrypoint.sh.release b/entrypoint.sh.release index bb0744e82..f104d4fca 100644 --- a/entrypoint.sh.release +++ b/entrypoint.sh.release @@ -71,13 +71,23 @@ trap killzerotier INT TERM log "Configuring networks to join" mkdir -p /var/lib/zerotier-one/networks.d -log_params "Joining networks:" $@ +log_params "Joining networks from command line:" $@ for i in "$@" do log_detail_params "Configuring join:" "$i" touch "/var/lib/zerotier-one/networks.d/${i}.conf" 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" nohup /usr/sbin/zerotier-one &