File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
package/thingino-webui/files Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 55
66OS_RELEASE_FILE=${OS_RELEASE_FILE:-/ etc/ os-release}
77WEBUI_JS_CONFIG=${WEBUI_JS_CONFIG:-/ var/ www/ a/ runtime-config.js}
8+ API_KEY_FILE=${API_KEY_FILE:-/ etc/ thingino-api.key}
89
910escape () {
1011 printf ' %s' " $1 " | sed ' s/\\/\\\\/g; s/"/\\"/g'
@@ -16,6 +17,13 @@ if [ ! -f "$OS_RELEASE_FILE" ]; then
1617fi
1718
1819start () {
20+ if [ ! -f " $API_KEY_FILE " ]; then
21+ echo_info " Generating API key"
22+ new_key=$( head -c 32 /dev/urandom | hexdump -e ' 32/1 "%02x" "\n"' )
23+ echo " $new_key " > " $API_KEY_FILE "
24+ chmod 600 " $API_KEY_FILE "
25+ fi
26+
1927 hostname=" $( hostname -s) "
2028 timezone=" $( cat /etc/timezone 2> /dev/null || echo UTC) "
2129 image_id=" $( awk -F= ' /^IMAGE_ID=/{gsub(/"/, "", $2); print $2}' " $OS_RELEASE_FILE " ) "
You can’t perform that action at this time.
0 commit comments