mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-10 18:01:03 +01:00
fix: auto-fix linting issues
This commit is contained in:
committed by
github-actions[bot]
parent
e5adbd266f
commit
f728166b14
@@ -16,19 +16,18 @@ sed -i "s|%%interface%%|$(bashio::addon.ip_address)|g" /etc/nginx/servers/ssl.co
|
||||
|
||||
# Ssl values
|
||||
if bashio::config.true 'ssl'; then
|
||||
echo "Defining ssl configuration"
|
||||
bashio::config.require.ssl
|
||||
certfile=$(bashio::config 'certfile')
|
||||
keyfile=$(bashio::config 'keyfile')
|
||||
echo "Defining ssl configuration"
|
||||
bashio::config.require.ssl
|
||||
certfile=$(bashio::config 'certfile')
|
||||
keyfile=$(bashio::config 'keyfile')
|
||||
|
||||
#Check if files exist
|
||||
echo "... checking if referenced certificates exist"
|
||||
[ ! -f /ssl/"$certfile" ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$certfile not found" && bashio::exit.nok
|
||||
[ ! -f /ssl/"$keyfile" ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$keyfile not found" && bashio::exit.nok
|
||||
#Check if files exist
|
||||
echo "... checking if referenced certificates exist"
|
||||
[ ! -f /ssl/"$certfile" ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$certfile not found" && bashio::exit.nok
|
||||
[ ! -f /ssl/"$keyfile" ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$keyfile not found" && bashio::exit.nok
|
||||
|
||||
|
||||
sed -i "s|default_server|ssl|g" /etc/nginx/servers/ssl.conf
|
||||
sed -i "/proxy_params.conf/a ssl_certificate /ssl/$certfile;" /etc/nginx/servers/ssl.conf
|
||||
sed -i "/proxy_params.conf/a ssl_certificate_key /ssl/$keyfile;" /etc/nginx/servers/ssl.conf
|
||||
bashio::log.info "Ssl enabled, please use https for connection. UI is at https://YOURIP:$(bashio::addon.port "$port")"
|
||||
sed -i "s|default_server|ssl|g" /etc/nginx/servers/ssl.conf
|
||||
sed -i "/proxy_params.conf/a ssl_certificate /ssl/$certfile;" /etc/nginx/servers/ssl.conf
|
||||
sed -i "/proxy_params.conf/a ssl_certificate_key /ssl/$keyfile;" /etc/nginx/servers/ssl.conf
|
||||
bashio::log.info "Ssl enabled, please use https for connection. UI is at https://YOURIP:$(bashio::addon.port "$port")"
|
||||
fi
|
||||
|
||||
@@ -6,21 +6,21 @@ set -e
|
||||
# Set structure #
|
||||
#################
|
||||
for folders in config users indexdir secret media cache thumbnail_cache persist; do
|
||||
mkdir -p /config/"$folders"
|
||||
if [ -d /app/"$folders" ] && [ "$(ls -A /app/"$folders")" ]; then
|
||||
cp -rn /app/"$folders"/* /config/"$folders"
|
||||
fi
|
||||
rm -rf /app/"$folders"
|
||||
ln -sf /config/"$folders" /app/"$folders"
|
||||
mkdir -p /config/"$folders"
|
||||
if [ -d /app/"$folders" ] && [ "$(ls -A /app/"$folders")" ]; then
|
||||
cp -rn /app/"$folders"/* /config/"$folders"
|
||||
fi
|
||||
rm -rf /app/"$folders"
|
||||
ln -sf /config/"$folders" /app/"$folders"
|
||||
done
|
||||
|
||||
# Persist database and plugins
|
||||
mkdir -p /config/gramps
|
||||
if [ -d /root/.gramps ]; then
|
||||
if [ "$(ls -A /root/.gramps)" ]; then
|
||||
cp -rf /root/.gramps/* /config/gramps
|
||||
fi
|
||||
rm -rf /root/.gramps
|
||||
if [ "$(ls -A /root/.gramps)" ]; then
|
||||
cp -rf /root/.gramps/* /config/gramps
|
||||
fi
|
||||
rm -rf /root/.gramps
|
||||
fi
|
||||
ln -sf /config/gramps /root/.gramps
|
||||
|
||||
@@ -29,22 +29,22 @@ ln -sf /config/gramps /root/.gramps
|
||||
#####################
|
||||
# Check if the secret key is defined in addon options
|
||||
if bashio::config.has_value "GRAMPSWEB_SECRET_KEY"; then
|
||||
bashio::log.warning "Using the secret key defined in the addon options."
|
||||
GRAMPSWEB_SECRET_KEY="$(bashio::config "GRAMPSWEB_SECRET_KEY")"
|
||||
export GRAMPSWEB_SECRET_KEY
|
||||
bashio::log.warning "Using the secret key defined in the addon options."
|
||||
GRAMPSWEB_SECRET_KEY="$(bashio::config "GRAMPSWEB_SECRET_KEY")"
|
||||
export GRAMPSWEB_SECRET_KEY
|
||||
else
|
||||
# Check if the secret file exists; if not, create a new one
|
||||
if [ ! -s /config/secret/secret ]; then
|
||||
bashio::log.warning "No secret key found in /config/secret/secret, generating a new one."
|
||||
mkdir -p /config/secret
|
||||
python3 -c "import secrets; print(secrets.token_urlsafe(32))" | tr -d "\n" > /config/secret/secret
|
||||
bashio::log.warning "New secret key generated and stored in /config/secret/secret"
|
||||
fi
|
||||
bashio::log.warning "Using existing secret key from /config/secret/secret."
|
||||
bashio::log.warning "Secret key saved to addon options."
|
||||
GRAMPSWEB_SECRET_KEY="$(cat /config/secret/secret)"
|
||||
export GRAMPSWEB_SECRET_KEY
|
||||
bashio::addon.option "GRAMPSWEB_SECRET_KEY" "$GRAMPSWEB_SECRET_KEY"
|
||||
# Check if the secret file exists; if not, create a new one
|
||||
if [ ! -s /config/secret/secret ]; then
|
||||
bashio::log.warning "No secret key found in /config/secret/secret, generating a new one."
|
||||
mkdir -p /config/secret
|
||||
python3 -c "import secrets; print(secrets.token_urlsafe(32))" | tr -d "\n" >/config/secret/secret
|
||||
bashio::log.warning "New secret key generated and stored in /config/secret/secret"
|
||||
fi
|
||||
bashio::log.warning "Using existing secret key from /config/secret/secret."
|
||||
bashio::log.warning "Secret key saved to addon options."
|
||||
GRAMPSWEB_SECRET_KEY="$(cat /config/secret/secret)"
|
||||
export GRAMPSWEB_SECRET_KEY
|
||||
bashio::addon.option "GRAMPSWEB_SECRET_KEY" "$GRAMPSWEB_SECRET_KEY"
|
||||
fi
|
||||
|
||||
##################
|
||||
@@ -73,7 +73,8 @@ CELERY_PID=$!
|
||||
# Staring nginx #
|
||||
#################
|
||||
echo "Starting nginx..."
|
||||
exec nginx & bashio::log.info "Starting nginx"
|
||||
exec nginx &
|
||||
bashio::log.info "Starting nginx"
|
||||
NGINX_PID=$!
|
||||
|
||||
# Wait for all background processes
|
||||
|
||||
Reference in New Issue
Block a user