feat: Generate a random Nightscout API_SECRET during installation, save it to ~/nightscout.creds, and update related documentation.

This commit is contained in:
Francesco Vattiato
2026-01-19 23:29:45 +01:00
parent 24c2fb2613
commit 8d9ef8b17d
2 changed files with 11 additions and 5 deletions

View File

@@ -14,9 +14,9 @@ update_os
msg_info "Installing Dependencies"
$STD apt install -y \
git \
build-essential \
libssl-dev
libssl-dev \
openssl
msg_ok "Installed Dependencies"
MONGO_VERSION="8.0" setup_mongodb
@@ -30,10 +30,11 @@ msg_ok "Installed Nightscout"
msg_info "Creating Service"
useradd -s /bin/bash -m nightscout
chown -R nightscout:nightscout /opt/nightscout
API_SECRET=$(openssl rand -hex 16)
cat <<EOF >/opt/nightscout/my.env
MONGO_CONNECTION=mongodb://127.0.0.1:27017/nightscout
BASE_URL=http://localhost:1337
API_SECRET=yoursecret123
API_SECRET=${API_SECRET}
DISPLAY_UNITS=mg/dl
ENABLE=careportal boluscalc food bwp cage sage iage iob cob basal ar2 rawbg pushover bgi pump openaps pvb linear custom
INSECURE_USE_HTTP=true
@@ -58,6 +59,11 @@ EOF
systemctl enable -q --now nightscout
msg_ok "Created Service"
{
echo "Nightscout Credentials"
echo "API_SECRET: ${API_SECRET}"
} >> ~/nightscout.creds
motd_ssh
customize
cleanup_lxc