add init scripts to the wordpress image

This commit is contained in:
jdrios
2017-05-17 20:37:32 +02:00
parent e48405ba8f
commit 006b18a2e0
2 changed files with 30 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ print_welcome_page
check_for_updates &
if [[ "$1" == "nami" && "$2" == "start" ]] || [[ "$1" == "/init.sh" ]]; then
. /init.sh
nami_initialize apache php mysql-client wordpress
info "Starting wordpress... "
fi

View File

@@ -0,0 +1,29 @@
##
## @brief Helper function to show an error when a password is empty and exit
## param $1 Input name
##
empty_password_error() {
error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development."
exit 1
}
##
## @brief Helper function to show a warning when the ALLOW_EMPTY_PASSWORD flag is enabled
##
empty_password_enabled_warn() {
warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment."
}
# Validate passwords
if [[ "$ALLOW_EMPTY_PASSWORD" =~ ^(yes|Yes|YES)$ ]]; then
empty_password_enabled_warn
else
# Database creation by MySQL client
if [[ -n "$MYSQL_CLIENT_CREATE_DATABASE_USER" && -z "$MYSQL_CLIENT_CREATE_DATABASE_PASSWORD" ]]; then
empty_password_error MSQL_CLIENT_CREATE_DATABASE_PASSWORD
fi
# WordPress database
if [[ -z "$WORDPRESS_DATABASE_PASSWORD" ]]; then
empty_password_error WORDPRESS_DATABASE_PASSWORD
fi
fi