feat: Generate a random Nightscout API_SECRET during installation, save it to ~/nightscout.creds, and update related documentation.
This commit is contained in:
parent
24c2fb2613
commit
8d9ef8b17d
@ -33,7 +33,7 @@
|
|||||||
},
|
},
|
||||||
"notes": [
|
"notes": [
|
||||||
{
|
{
|
||||||
"text": "Nightscout requires configuring `my.env` with your Mongo connection string and API_SECRET. Default API_SECRET is `yoursecret123`.",
|
"text": "Nightscout requires configuring `my.env` with your Mongo connection string. API_SECRET has been generated and saved to `~/nightscout.creds`.",
|
||||||
"type": "info"
|
"type": "info"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -41,7 +41,7 @@
|
|||||||
"type": "info"
|
"type": "info"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "Official Configuration Guide: [Nightscout Documentation](https://nightscout.github.io/nightscout/setup_variables/)",
|
"text": "Official Configuration Guide: https://nightscout.github.io/nightscout/setup_variables/",
|
||||||
"type": "info"
|
"type": "info"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -14,9 +14,9 @@ update_os
|
|||||||
|
|
||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies"
|
||||||
$STD apt install -y \
|
$STD apt install -y \
|
||||||
git \
|
|
||||||
build-essential \
|
build-essential \
|
||||||
libssl-dev
|
libssl-dev \
|
||||||
|
openssl
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
MONGO_VERSION="8.0" setup_mongodb
|
MONGO_VERSION="8.0" setup_mongodb
|
||||||
@ -30,10 +30,11 @@ msg_ok "Installed Nightscout"
|
|||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
useradd -s /bin/bash -m nightscout
|
useradd -s /bin/bash -m nightscout
|
||||||
chown -R nightscout:nightscout /opt/nightscout
|
chown -R nightscout:nightscout /opt/nightscout
|
||||||
|
API_SECRET=$(openssl rand -hex 16)
|
||||||
cat <<EOF >/opt/nightscout/my.env
|
cat <<EOF >/opt/nightscout/my.env
|
||||||
MONGO_CONNECTION=mongodb://127.0.0.1:27017/nightscout
|
MONGO_CONNECTION=mongodb://127.0.0.1:27017/nightscout
|
||||||
BASE_URL=http://localhost:1337
|
BASE_URL=http://localhost:1337
|
||||||
API_SECRET=yoursecret123
|
API_SECRET=${API_SECRET}
|
||||||
DISPLAY_UNITS=mg/dl
|
DISPLAY_UNITS=mg/dl
|
||||||
ENABLE=careportal boluscalc food bwp cage sage iage iob cob basal ar2 rawbg pushover bgi pump openaps pvb linear custom
|
ENABLE=careportal boluscalc food bwp cage sage iage iob cob basal ar2 rawbg pushover bgi pump openaps pvb linear custom
|
||||||
INSECURE_USE_HTTP=true
|
INSECURE_USE_HTTP=true
|
||||||
@ -58,6 +59,11 @@ EOF
|
|||||||
systemctl enable -q --now nightscout
|
systemctl enable -q --now nightscout
|
||||||
msg_ok "Created Service"
|
msg_ok "Created Service"
|
||||||
|
|
||||||
|
{
|
||||||
|
echo "Nightscout Credentials"
|
||||||
|
echo "API_SECRET: ${API_SECRET}"
|
||||||
|
} >> ~/nightscout.creds
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
customize
|
customize
|
||||||
cleanup_lxc
|
cleanup_lxc
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user