This commit is contained in:
Alexandre
2022-01-14 17:12:15 +01:00
3 changed files with 15 additions and 3 deletions

View File

@@ -4,7 +4,8 @@
"description": "recipe manager", "description": "recipe manager",
"environment": { "environment": {
"DB_ENGINE": "django.db.backends.sqlite3", "DB_ENGINE": "django.db.backends.sqlite3",
"POSTGRES_DB": "/config/addons_config/tandoor_recipes/recipes.db" "POSTGRES_DB": "/config/addons_config/tandoor_recipes/recipes.db",
"DEBUG": "0"
}, },
"map": ["config:rw"], "map": ["config:rw"],
"name": "Tandoor recipes", "name": "Tandoor recipes",
@@ -22,7 +23,7 @@
"services": ["mysql:want"], "services": ["mysql:want"],
"schema": { "schema": {
"SECRET_KEY": "str", "SECRET_KEY": "str",
"DB_TYPE": "list(sqlite|postgresql_external|mariadb_addon)", "DB_TYPE": "list(sqlite|postgresql_external)",
"ALLOWED_HOSTS": "str?", "ALLOWED_HOSTS": "str?",
"POSTGRES_HOST": "str?", "POSTGRES_HOST": "str?",
"POSTGRES_PORT": "str?", "POSTGRES_PORT": "str?",
@@ -33,6 +34,6 @@
"slug": "tandoor_recipes", "slug": "tandoor_recipes",
"upstream": "1.0.4", "upstream": "1.0.4",
"url": "https://github.com/alexbelgium/hassio-addons", "url": "https://github.com/alexbelgium/hassio-addons",
"version": "1.0.4-4", "version": "1.0.4-7",
"webui": "[PROTO:ssl]://[HOST]:[PORT:8080]" "webui": "[PROTO:ssl]://[HOST]:[PORT:8080]"
} }

View File

@@ -5,6 +5,7 @@
##################### #####################
export ALLOWED_HOSTS=$(bashio::config 'ALLOWED_HOSTS') && bashio::log.blue "ALLOWED_HOSTS=$ALLOWED_HOSTS" export ALLOWED_HOSTS=$(bashio::config 'ALLOWED_HOSTS') && bashio::log.blue "ALLOWED_HOSTS=$ALLOWED_HOSTS"
export SECRET_KEY=$(bashio::config 'SECRET_KEY') && bashio::log.blue "SECRET_KEY=$SECRET_KEY"
################### ###################
# Define database # # Define database #
@@ -30,6 +31,9 @@ mariadb_addon)
"Please ensure it is installed and started" "Please ensure it is installed and started"
fi fi
# Install mysqlclient
pip install pymysql &>/dev/null
# Use values # Use values
export DB_ENGINE=django.db.backends.mysql export DB_ENGINE=django.db.backends.mysql
export POSTGRES_HOST=$(bashio::services "mysql" "host") && bashio::log.blue "POSTGRES_HOST=$POSTGRES_HOST" export POSTGRES_HOST=$(bashio::services "mysql" "host") && bashio::log.blue "POSTGRES_HOST=$POSTGRES_HOST"

View File

@@ -116,6 +116,13 @@ for files in "/etc/cont-init.d" "/etc/services.d"; do
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES sqlite3" [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES sqlite3"
fi fi
COMMAND="mysql"
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then
[ "$VERBOSE" = true ] && echo "$COMMAND required"
[ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES mysql-client"
[ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES mysql-client"
fi
COMMAND="pip" COMMAND="pip"
if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then
[ "$VERBOSE" = true ] && echo "$COMMAND required" [ "$VERBOSE" = true ] && echo "$COMMAND required"