mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-09 08:46:54 +02:00
Merge pull request #2445 from zerotier/docker-local-conf
Allow setting local.conf content from Docker environment variable
This commit is contained in:
commit
cadfa0bc4d
2 changed files with 9 additions and 2 deletions
|
@ -64,6 +64,7 @@ You can control a few settings including the identity used and the authtoken use
|
||||||
- `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.
|
||||||
|
- `ZEROTIER_LOCAL_CONF`: Sets the the `local.conf` file content for zerotier-one
|
||||||
|
|
||||||
### Tips
|
### Tips
|
||||||
|
|
||||||
|
|
|
@ -9,15 +9,16 @@ mkztfile() {
|
||||||
file=$1
|
file=$1
|
||||||
mode=$2
|
mode=$2
|
||||||
content=$3
|
content=$3
|
||||||
|
echo "creating $file"
|
||||||
mkdir -p /var/lib/zerotier-one
|
mkdir -p /var/lib/zerotier-one
|
||||||
echo "$content" > "/var/lib/zerotier-one/$file"
|
echo -n "$content" > "/var/lib/zerotier-one/$file"
|
||||||
chmod "$mode" "/var/lib/zerotier-one/$file"
|
chmod "$mode" "/var/lib/zerotier-one/$file"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "x$ZEROTIER_API_SECRET" != "x" ]
|
if [ "x$ZEROTIER_API_SECRET" != "x" ]
|
||||||
then
|
then
|
||||||
mkztfile authtoken.secret 0600 "$ZEROTIER_API_SECRET"
|
mkztfile authtoken.secret 0600 "$ZEROTIER_API_SECRET"
|
||||||
|
mkztfile metricstoken.secret 0600 "$ZEROTIER_API_SECRET"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x$ZEROTIER_IDENTITY_PUBLIC" != "x" ]
|
if [ "x$ZEROTIER_IDENTITY_PUBLIC" != "x" ]
|
||||||
|
@ -30,6 +31,11 @@ then
|
||||||
mkztfile identity.secret 0600 "$ZEROTIER_IDENTITY_SECRET"
|
mkztfile identity.secret 0600 "$ZEROTIER_IDENTITY_SECRET"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "x$ZEROTIER_LOCAL_CONF" != "x" ]
|
||||||
|
then
|
||||||
|
mkztfile local.conf 0644 "$ZEROTIER_LOCAL_CONF"
|
||||||
|
fi
|
||||||
|
|
||||||
mkztfile zerotier-one.port 0600 "9993"
|
mkztfile zerotier-one.port 0600 "9993"
|
||||||
|
|
||||||
killzerotier() {
|
killzerotier() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue