From 4595d836669e39a86cd06a6b288ef074df45a293 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20B=C3=A9dard-Couture?= <remi.bc@outlook.com>
Date: Tue, 22 Oct 2024 15:46:20 -0400
Subject: [PATCH] Create settings file (necessary with v3)

---
 install/peanut-install.sh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/install/peanut-install.sh b/install/peanut-install.sh
index 1db21f0a..c73914e2 100644
--- a/install/peanut-install.sh
+++ b/install/peanut-install.sh
@@ -44,6 +44,14 @@ $STD npm install -g pnpm
 $STD pnpm i
 $STD pnpm run build
 cp -r .next/static .next/standalone/.next/
+cat <<EOF >/opt/peanut/.next/standalone/config/settings.yml
+WEB_HOST: 0.0.0.0
+WEB_PORT: 3000
+NUT_HOST: 0.0.0.0
+NUT_PORT: 3493
+EOF
+mkdir -p /etc/peanut
+ln -sf /opt/peanut/.next/standalone/config/settings.yml /etc/peanut/settings.yml
 msg_ok "Installed Peanut"
 
 msg_info "Creating Service"
@@ -57,10 +65,10 @@ Restart=always
 RestartSec=5
 Type=simple
 Environment="NODE_ENV=production"
-Environment="NUT_HOST=localhost"
-Environment="NUT_PORT=3493"
-Environment="WEB_HOST=0.0.0.0"
-Environment="WEB_PORT=3000"
+#Environment="NUT_HOST=localhost"
+#Environment="NUT_PORT=3493"
+#Environment="WEB_HOST=0.0.0.0"
+#Environment="WEB_PORT=3000"
 WorkingDirectory=/opt/peanut
 ExecStart=node /opt/peanut/.next/standalone/server.js
 TimeoutStopSec=30