mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-21 16:21:51 +02:00
Create 61-trusted_domains
This commit is contained in:
40
nextcloud/root/etc/cont-init.d/61-trusted_domains
Normal file
40
nextcloud/root/etc/cont-init.d/61-trusted_domains
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/with-contenv bashio
|
||||||
|
|
||||||
|
if bashio::config.has_value 'trusted_domains'; then
|
||||||
|
bashio::log.info "Trusted domains set in the configuration. Refreshing domains." && \
|
||||||
|
|
||||||
|
####################
|
||||||
|
# Set occ location #
|
||||||
|
####################
|
||||||
|
LAUNCHER="/usr/bin/occ"
|
||||||
|
if ! bashio::fs.file_exists '/usr/bin/occ'; then
|
||||||
|
LAUNCHER=`find / -name "occ" -print -quit`
|
||||||
|
fi
|
||||||
|
|
||||||
|
###################################
|
||||||
|
# Remove previous trusted domains #
|
||||||
|
###################################
|
||||||
|
bashio::log.info "... removing previously added trusted domain (except for first one created)"
|
||||||
|
i=2
|
||||||
|
until [ $i -gt 5 ]
|
||||||
|
do
|
||||||
|
$LAUNCHER config:system:delete trusted_domains $i && \
|
||||||
|
((i=i+1))
|
||||||
|
done
|
||||||
|
|
||||||
|
###########################
|
||||||
|
# Add new trusted domains #
|
||||||
|
###########################
|
||||||
|
TRUSTEDDOMAINS=$(bashio::config 'trusted_domains')
|
||||||
|
bashio::log.info "... alignement with trusted domains list : ${TRUSTEDDOMAINS}" && \
|
||||||
|
i=2
|
||||||
|
for domain in $TRUSTEDDOMAINS
|
||||||
|
do
|
||||||
|
bashio::log.info "... adding ${domain}" && \
|
||||||
|
$LAUNCHER config:system:set trusted_domains $i --value=${domain} && \
|
||||||
|
((i=i+1))
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
bashio::log.info "Remaining configurated trusted domains :"
|
||||||
|
bashio::log.info `$LAUNCHER -u abc:abc config:system:get trusted_domains`
|
||||||
Reference in New Issue
Block a user