Revert OctoPrint version; Add script to update config.

This commit is contained in:
Fredrik Baberg 2022-12-19 14:15:55 +01:00
parent e21dad4aeb
commit 6729d5684a
3 changed files with 58 additions and 10 deletions

View File

@ -9,4 +9,4 @@ labels:
org.opencontainers.image.description: "3DPrinter-OctoPrint addon for Home-Assistant."
org.opencontainers.image.source: "https://github.com/fredrikbaberg/3dprinter-addons"
args:
OCTOPRINT_VERSION: "1.8.6"
OCTOPRINT_VERSION: "1.8.2"

View File

@ -28,12 +28,12 @@ if [ ! -f /data/config/octoprint/config.yaml ]; then
fi
fi
{ # Make sure Ingress user for OctoPrint exists.
bashio::log.notice "Ensure Ingress user (homeassistant) exist."
if ! octoprint --basedir /data/config/octoprint user list | grep -q 'homeassistant'; then
new_password=$(date +%s | sha256sum | base64 | head -c 32 ; echo)
octoprint --basedir /data/config/octoprint user add --password "$new_password" --admin homeassistant # 2> /dev/null
fi
} || { # catch
bashio::log.warning "Failed to ensure Ingress user exists, may not be able to launch."
}
# { # Make sure Ingress user for OctoPrint exists.
# bashio::log.notice "Ensure Ingress user (homeassistant) exist."
# if ! octoprint --basedir /data/config/octoprint user list | grep -q 'homeassistant'; then
# new_password=$(date +%s | sha256sum | base64 | head -c 32 ; echo)
# octoprint --basedir /data/config/octoprint user add --password "$new_password" --admin homeassistant # 2> /dev/null
# fi
# } || { # catch
# bashio::log.warning "Failed to ensure Ingress user exists, may not be able to launch."
# }

View File

@ -0,0 +1,48 @@
#!/usr/bin/bash
# Set/update parts of OctoPrint config to work with addon.
export OCTOPRINT_HOME=/data/config/octoprint
# Access control
octoprint -b $OCTOPRINT_HOME config set --json accessControl '
{
"localNetworks": [
"127.0.0.0/8",
"::1/128",
"172.30.32.2"
]
}
'
# API config
octoprint -b $OCTOPRINT_HOME config set --json api '
{
"allowCrossOrigin": true
}
'
# Folder config
octoprint -b $OCTOPRINT_HOME config set --json folder '
{
"generated": "/tmp/octoprint/generated",
"timelapse_tmp": "/tmp/octoprint/timelapse/tmp"
}
'
# Server config
octoprint -b $OCTOPRINT_HOME config set --json server '
{
"allowFraming": true,
"commands": {
"serverRestartCommand": "/scripts/octoprint_restart.sh",
"systemRestartCommand": "/scripts/system_restart.sh",
"systemShutdownCommand": "/scripts/system_shutdown.sh"
}
}
'
# Webcam config
octoprint -b $OCTOPRINT_HOME config set --json webcam '
{
"ffmpeg": "/usr/bin/ffmpeg"
}
'