mirror of
https://github.com/koush/scrypted.git
synced 2026-07-04 06:40:29 +01:00
ha: autogenerate admin token
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
name: Scrypted
|
||||
version: "homeassistant-v0.11.0"
|
||||
slug: scrypted
|
||||
description: A home automation platform powered by node.js
|
||||
description: Scrypted is a high performance home video integration and automation platform
|
||||
url: "https://github.com/koush/scrypted"
|
||||
arch:
|
||||
- amd64
|
||||
@@ -30,8 +30,6 @@ options:
|
||||
env_vars:
|
||||
- name: SCRYPTED_ADMIN_USERNAME
|
||||
value: homeassistant
|
||||
- name: SCRYPTED_ADMIN_TOKEN
|
||||
value: homeassistant
|
||||
- name: SCRYPTED_NVR_VOLUME
|
||||
value: /data/scrypted_data/recordings
|
||||
schema:
|
||||
|
||||
@@ -18,12 +18,13 @@ for var in $(bashio::config 'env_vars|keys'); do
|
||||
done
|
||||
|
||||
|
||||
if [[ ! -v SCRYPTED_ADMIN_TOKEN || -z "$SCRYPTED_ADMIN_TOKEN" ]];
|
||||
if [[ ! -v SCRYPTED_ADMIN_USERNAME || -z "$SCRYPTED_ADMIN_USERNAME" ]];
|
||||
then
|
||||
bashio::log.info "No SCRYPTED_ADMIN_TOKEN setting found, removing proxy_pass_header config."
|
||||
bashio::log.info "No SCRYPTED_ADMIN_USERNAME setting found, removing proxy_pass_header config."
|
||||
sed -i "s/.*Authorization.*//g" /etc/nginx/servers/ingress.conf
|
||||
else
|
||||
bashio::log.info "SCRYPTED_ADMIN_TOKEN setting found, adding proxy_pass_header config."
|
||||
export SCRYPTED_ADMIN_TOKEN=$(echo $RANDOM$RANDOM$RANDOM$RANDOM$RANDOM | md5sum)
|
||||
bashio::log.info "SCRYPTED_ADMIN_USERNAME setting found, adding proxy_pass_header config."
|
||||
sed -i "s/%%authorization_header%%/$SCRYPTED_ADMIN_TOKEN/g" /etc/nginx/servers/ingress.conf
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user