n8n: refactor environmentfile (#6297)

* n8n: add config path

* n8n: refactor servicefile to seperate env

* n8n: refactor envfile

* Update n8n.sh

* Update n8n.json

---------

Co-authored-by: Slaviša Arežina <58952836+tremor021@users.noreply.github.com>
This commit is contained in:
Tobias
2025-07-28 13:33:51 +02:00
committed by GitHub
parent 9c50105e86
commit 759239bc7c
3 changed files with 31 additions and 5 deletions

View File

@@ -34,6 +34,18 @@ function update_script() {
echo "Installed NPM..."
fi
fi
if [ ! -f /opt/n8n.env ]; then
sed -i 's|^Environment="N8N_SECURE_COOKIE=false"$|EnvironmentFile="/opt/n8n.env"|' /etc/systemd/system/n8n.service
HOST_IP=$(hostname -I | awk '{print $1}')
mkdir -p /opt
cat <<EOF >/opt/n8n.env
N8N_SECURE_COOKIE=false
N8N_PORT=5678
N8N_PROTOCOL=http
N8N_HOST=$HOST_IP
EOF
fi
msg_info "Updating ${APP} LXC"
$STD npm update -g n8n
systemctl restart n8n
@@ -48,4 +60,4 @@ description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:5678${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:5678${CL}"