mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-24 13:36:29 +01:00
Merge branch 'master' into patch-2
This commit is contained in:
@@ -31,7 +31,7 @@ fi
|
||||
|
||||
# Check if yaml is valid
|
||||
EXIT_CODE=0
|
||||
yamllint -d relaxed --no-warnings $CONFIGSOURCE &>ERROR || EXIT_CODE=$?
|
||||
yamllint -d relaxed $CONFIGSOURCE &>ERROR || EXIT_CODE=$?
|
||||
if [ $EXIT_CODE = 0 ]; then
|
||||
echo "Config file is a valid yaml"
|
||||
else
|
||||
@@ -46,10 +46,10 @@ function parse_yaml {
|
||||
local prefix=$2 || local prefix=""
|
||||
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @ | tr @ '\034')
|
||||
sed -ne "s|^\($s\):|\1|" \
|
||||
-e "s| #.*$||g" \
|
||||
-e "s|#.*$||g" \
|
||||
-e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \
|
||||
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
|
||||
-e "s| #.*$||g" \
|
||||
-e "s|#.*$||g" \
|
||||
-e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \
|
||||
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
|
||||
awk -F$fs '{
|
||||
indent = length($1)/2;
|
||||
vname[indent] = $2;
|
||||
|
||||
@@ -6,8 +6,49 @@
|
||||
|
||||
export BASE_URL=$(bashio::config 'BASE_URL'):$(bashio::addon.port 80)
|
||||
#export LANG=$(bashio::config 'LANG')
|
||||
|
||||
|
||||
###################
|
||||
# Define database #
|
||||
###################
|
||||
|
||||
bashio::log.info "Defining database"
|
||||
export DB_TYPE=$(bashio::config 'DB_TYPE')
|
||||
[ $DB_TYPE = "sqlite" ] && bashio::log.info "Using a local sqlite database $WEBTREES_HOME/$DB_NAME please wait then login. Default credentials : $WT_USER : $WT_PASS"
|
||||
case $(bashio::config 'DB_TYPE') in
|
||||
|
||||
# Use sqlite
|
||||
sqlite)
|
||||
bashio::log.info "Using a local sqlite database $WEBTREES_HOME/$DB_NAME please wait then login. Default credentials : $WT_USER : $WT_PASS"
|
||||
;;
|
||||
|
||||
mariadb_addon)
|
||||
bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..."
|
||||
if ! bashio::services.available 'mysql'; then
|
||||
bashio::log.fatal \
|
||||
"Local database access should be provided by the MariaDB addon"
|
||||
bashio::exit.nok \
|
||||
"Please ensure it is installed and started"
|
||||
fi
|
||||
|
||||
# Use values
|
||||
export DB_TYPE=mysql
|
||||
export DB_HOST=$(bashio::services "mysql" "host") && bashio::log.blue "DB_HOST=$DB_HOST"
|
||||
export DB_PORT=$(bashio::services "mysql" "port") && bashio::log.blue "DB_PORT=$DB_PORT"
|
||||
export DB_NAME=webtrees && bashio::log.blue "DB_NAME=$DB_NAME"
|
||||
export DB_USER=$(bashio::services "mysql" "username") && bashio::log.blue "DB_USER=$DB_USER"
|
||||
export DB_PASS=$(bashio::services "mysql" "password") && bashio::log.blue "DB_PASS=$DB_PASS"
|
||||
|
||||
bashio::log.warning "Webtrees is using the Maria DB addon"
|
||||
bashio::log.warning "Please ensure this is included in your backups"
|
||||
bashio::log.warning "Uninstalling the MariaDB addon will remove any data"
|
||||
;;
|
||||
|
||||
external)
|
||||
bashio::log.info "Using an external database, please populate all required fields in the config.yaml according to dovumentation"
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
|
||||
################
|
||||
# SSL CONFIG #
|
||||
|
||||
Reference in New Issue
Block a user