diff --git a/conf/env b/conf/env new file mode 100644 index 0000000..8aafc23 --- /dev/null +++ b/conf/env @@ -0,0 +1,3 @@ +ZT_TOKEN=__ZT_TOKEN__ +ZT_ADDR=__ZT_ADDR__ +HTTP_PORT=__PORT__ diff --git a/scripts/install b/scripts/install index f3af27e..3b77b91 100644 --- a/scripts/install +++ b/scripts/install @@ -120,19 +120,17 @@ popd # MODIFY A CONFIG FILE #================================================= -# Setup env file -mkdir -p $final_path -env_file=$final_path/src/.env -touch $env_file -chmod 600 $env_file +# Let's retrieve information on the ZeroTier installation +ZT_TOKEN="$(> $env_file -echo "ZT_ADDR=localhost:$(> $env_file -echo "HTTP_PORT=$port" >> $env_file +ynh_add_config --template="env" --destination="$final_path/.env" +chown $app:$app "$final_path/.env" +chmod 600 "$final_path/.env" # Setup user credentials file hashedpassword=$(echo -n "$password" | $final_path/src/node_modules/.bin/argon2-cli -e) -echo "{\"$admin\":{\"name\":\"$admin\",\"pass_set\":true,\"hash\":\"$hashedpassword\"}}" >> "$final_path/src/etc/passwd" +echo "{\"$admin\":{\"name\":\"$admin\",\"pass_set\":true,\"hash\":\"$hashedpassword\"}}" > "$final_path/src/etc/passwd" # Store user settings ynh_app_setting_set --app=$app --key=admin --value=$admin