Merge branch 'master' into patch-2

This commit is contained in:
Alexandre
2021-12-28 16:20:29 +01:00
committed by GitHub
46 changed files with 964 additions and 110 deletions

View File

@@ -1,3 +1,9 @@
- Allow Mariadb addon autodiscovery as database
## 2.1.0-alpha.1 (28-12-2021)
- Switch to 2.1
- Update to latest version from nathanvaughn/webtrees-docker
- Update to latest version from nathanvaughn/webtrees-docker
- New standardized logic for Dockerfile build and packages installation
## 2.0.19 (07-12-2021)

View File

@@ -14,7 +14,8 @@
#################
ARG BUILD_VERSION
FROM nathanvaughn/webtrees:latest
ARG BUILD_UPSTREAM="2.1.0-alpha.1"
FROM nathanvaughn/webtrees:$BUILD_UPSTREAM
##################
# 2 Modify Image #

View File

@@ -21,8 +21,7 @@ This addon is based on the docker image https://github.com/NathanVaughn/webtrees
## Configuration
Webui can be found at <http://your-ip:PORT>.
The default username/password : described in the startup log.
Please change it as soon as possible.
The default username/password : described in the startup log (admin:mybadpassword), please change it as soon as possible from the users admin page (yoursite:yourport/index.php?route=%2Fadmin%2Fadmin-users).
Options can be configured through two ways :
@@ -32,7 +31,7 @@ Options can be configured through two ways :
"LANG": "en-US" # Default language for webtrees
"BASE_URL": "http://192.168.178.69" # The url with which you access webtrees
"DB_TYPE": "sqlite" # Your database type : sqlite for automatic configuration, or external for manual config
"CONFIG_LOCATION": location of the config.yaml (see below)
"CONFIG_LOCATION": location of the config.yaml (see below)
```
- Config.yaml

View File

@@ -45,12 +45,13 @@
"schema": {
"CONFIG_LOCATION": "str",
"BASE_URL": "url",
"DB_TYPE": "list(sqlite|external)"
"DB_TYPE": "list(sqlite|external|mariadb_addon)"
},
"services": ["mysql:want"],
"slug": "webtrees",
"startup": "services",
"upstream": "2.0.19",
"upstream": "2.1.0-alpha.1",
"url": "https://github.com/alexbelgium/hassio-addons",
"version": "2.0.19",
"version": "2.1.0-alpha.1",
"webui": "[PROTO:ssl]://[HOST]:[PORT:80]"
}

View File

@@ -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;

View File

@@ -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 #