From a69654e1d82d8706ebadc42bc70b8f1ef57ecf92 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Wed, 22 Feb 2023 15:27:19 +0100 Subject: [PATCH] Regenerate scripts/doc --- .../share/container-scripts/postgresql/README.md | 7 +++++++ .../share/container-scripts/postgresql/common.sh | 16 ++++++++++++++-- .../share/container-scripts/postgresql/README.md | 7 +++++++ .../share/container-scripts/postgresql/common.sh | 16 ++++++++++++++-- .../share/container-scripts/postgresql/README.md | 7 +++++++ .../share/container-scripts/postgresql/common.sh | 16 ++++++++++++++-- .../share/container-scripts/postgresql/README.md | 7 +++++++ .../share/container-scripts/postgresql/common.sh | 16 ++++++++++++++-- 8 files changed, 84 insertions(+), 8 deletions(-) diff --git a/10/root/usr/share/container-scripts/postgresql/README.md b/10/root/usr/share/container-scripts/postgresql/README.md index e46787a7..beb9249e 100644 --- a/10/root/usr/share/container-scripts/postgresql/README.md +++ b/10/root/usr/share/container-scripts/postgresql/README.md @@ -74,6 +74,13 @@ initialization by passing `-e VAR=VALUE` to the Docker run command. **`POSTGRESQL_ADMIN_PASSWORD`** Password for the `postgres` admin account (optional) +The following environment variables are optional, and only used when the database is initialzed + +**`POSTGRESQL_ENCODING`** + Database encoding. Default to UTF8 + +**`POSTGRESQL_LOCALE`** + Database locale. Default to en_US Alternatively, the following options are related to migration scenario: diff --git a/10/root/usr/share/container-scripts/postgresql/common.sh b/10/root/usr/share/container-scripts/postgresql/common.sh index 1b339105..32ca9a79 100644 --- a/10/root/usr/share/container-scripts/postgresql/common.sh +++ b/10/root/usr/share/container-scripts/postgresql/common.sh @@ -189,7 +189,10 @@ initdb_wrapper () # Initialize the database cluster with utf8 support enabled by default. # This might affect performance, see: # http://www.postgresql.org/docs/10/static/locale.html - LANG=${LANG:-en_US.utf8} "$@" + ENCODING=${POSTGRESQL_ENCODING:-UTF8} + LOCALE=${POSTGRESQL_LOCALE:-en_US} + if [ ${LOCALE} == "C" ] ; then LANG=C; fi + LANG=${LANG:-$LOCALE.$ENCODING} "$@" -E $ENCODING } function initialize_database() { @@ -222,7 +225,16 @@ EOF function create_users() { if [[ ",$postinitdb_actions," = *,simple_db,* ]]; then createuser "$POSTGRESQL_USER" - createdb --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE" + + EXTRA_ARGS="" + if [ -v POSTGRESQL_ENCODING ]; then + EXTRA_ARGS="$EXTRA_ARGS -E $POSTGRESQL_ENCODING" + fi + if [ -v POSTGRESQL_LOCALE ]; then + EXTRA_ARGS="$EXTRA_ARGS -l $POSTGRESQL_LOCALE" + fi + + createdb $EXTRA_ARGS --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE" fi if [ -v POSTGRESQL_MASTER_USER ]; then diff --git a/12/root/usr/share/container-scripts/postgresql/README.md b/12/root/usr/share/container-scripts/postgresql/README.md index 5fdd9437..87dbe3a4 100644 --- a/12/root/usr/share/container-scripts/postgresql/README.md +++ b/12/root/usr/share/container-scripts/postgresql/README.md @@ -74,6 +74,13 @@ initialization by passing `-e VAR=VALUE` to the Docker run command. **`POSTGRESQL_ADMIN_PASSWORD`** Password for the `postgres` admin account (optional) +The following environment variables are optional, and only used when the database is initialzed + +**`POSTGRESQL_ENCODING`** + Database encoding. Default to UTF8 + +**`POSTGRESQL_LOCALE`** + Database locale. Default to en_US Alternatively, the following options are related to migration scenario: diff --git a/12/root/usr/share/container-scripts/postgresql/common.sh b/12/root/usr/share/container-scripts/postgresql/common.sh index fda53386..3a8039a2 100644 --- a/12/root/usr/share/container-scripts/postgresql/common.sh +++ b/12/root/usr/share/container-scripts/postgresql/common.sh @@ -189,7 +189,10 @@ initdb_wrapper () # Initialize the database cluster with utf8 support enabled by default. # This might affect performance, see: # http://www.postgresql.org/docs/12/static/locale.html - LANG=${LANG:-en_US.utf8} "$@" + ENCODING=${POSTGRESQL_ENCODING:-UTF8} + LOCALE=${POSTGRESQL_LOCALE:-en_US} + if [ ${LOCALE} == "C" ] ; then LANG=C; fi + LANG=${LANG:-$LOCALE.$ENCODING} "$@" -E $ENCODING } function initialize_database() { @@ -222,7 +225,16 @@ EOF function create_users() { if [[ ",$postinitdb_actions," = *,simple_db,* ]]; then createuser "$POSTGRESQL_USER" - createdb --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE" + + EXTRA_ARGS="" + if [ -v POSTGRESQL_ENCODING ]; then + EXTRA_ARGS="$EXTRA_ARGS -E $POSTGRESQL_ENCODING" + fi + if [ -v POSTGRESQL_LOCALE ]; then + EXTRA_ARGS="$EXTRA_ARGS -l $POSTGRESQL_LOCALE" + fi + + createdb $EXTRA_ARGS --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE" fi if [ -v POSTGRESQL_MASTER_USER ]; then diff --git a/13/root/usr/share/container-scripts/postgresql/README.md b/13/root/usr/share/container-scripts/postgresql/README.md index fbbc5047..3eef535f 100644 --- a/13/root/usr/share/container-scripts/postgresql/README.md +++ b/13/root/usr/share/container-scripts/postgresql/README.md @@ -74,6 +74,13 @@ initialization by passing `-e VAR=VALUE` to the Docker run command. **`POSTGRESQL_ADMIN_PASSWORD`** Password for the `postgres` admin account (optional) +The following environment variables are optional, and only used when the database is initialzed + +**`POSTGRESQL_ENCODING`** + Database encoding. Default to UTF8 + +**`POSTGRESQL_LOCALE`** + Database locale. Default to en_US Alternatively, the following options are related to migration scenario: diff --git a/13/root/usr/share/container-scripts/postgresql/common.sh b/13/root/usr/share/container-scripts/postgresql/common.sh index 15c11037..177a5fe0 100644 --- a/13/root/usr/share/container-scripts/postgresql/common.sh +++ b/13/root/usr/share/container-scripts/postgresql/common.sh @@ -189,7 +189,10 @@ initdb_wrapper () # Initialize the database cluster with utf8 support enabled by default. # This might affect performance, see: # http://www.postgresql.org/docs/13/static/locale.html - LANG=${LANG:-en_US.utf8} "$@" + ENCODING=${POSTGRESQL_ENCODING:-UTF8} + LOCALE=${POSTGRESQL_LOCALE:-en_US} + if [ ${LOCALE} == "C" ] ; then LANG=C; fi + LANG=${LANG:-$LOCALE.$ENCODING} "$@" -E $ENCODING } function initialize_database() { @@ -222,7 +225,16 @@ EOF function create_users() { if [[ ",$postinitdb_actions," = *,simple_db,* ]]; then createuser "$POSTGRESQL_USER" - createdb --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE" + + EXTRA_ARGS="" + if [ -v POSTGRESQL_ENCODING ]; then + EXTRA_ARGS="$EXTRA_ARGS -E $POSTGRESQL_ENCODING" + fi + if [ -v POSTGRESQL_LOCALE ]; then + EXTRA_ARGS="$EXTRA_ARGS -l $POSTGRESQL_LOCALE" + fi + + createdb $EXTRA_ARGS --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE" fi if [ -v POSTGRESQL_MASTER_USER ]; then diff --git a/15/root/usr/share/container-scripts/postgresql/README.md b/15/root/usr/share/container-scripts/postgresql/README.md index 7a4e4efb..6806c352 100644 --- a/15/root/usr/share/container-scripts/postgresql/README.md +++ b/15/root/usr/share/container-scripts/postgresql/README.md @@ -74,6 +74,13 @@ initialization by passing `-e VAR=VALUE` to the Docker run command. **`POSTGRESQL_ADMIN_PASSWORD`** Password for the `postgres` admin account (optional) +The following environment variables are optional, and only used when the database is initialzed + +**`POSTGRESQL_ENCODING`** + Database encoding. Default to UTF8 + +**`POSTGRESQL_LOCALE`** + Database locale. Default to en_US Alternatively, the following options are related to migration scenario: diff --git a/15/root/usr/share/container-scripts/postgresql/common.sh b/15/root/usr/share/container-scripts/postgresql/common.sh index 1f1a11d7..872ac0fb 100644 --- a/15/root/usr/share/container-scripts/postgresql/common.sh +++ b/15/root/usr/share/container-scripts/postgresql/common.sh @@ -189,7 +189,10 @@ initdb_wrapper () # Initialize the database cluster with utf8 support enabled by default. # This might affect performance, see: # http://www.postgresql.org/docs/15/static/locale.html - LANG=${LANG:-en_US.utf8} "$@" + ENCODING=${POSTGRESQL_ENCODING:-UTF8} + LOCALE=${POSTGRESQL_LOCALE:-en_US} + if [ ${LOCALE} == "C" ] ; then LANG=C; fi + LANG=${LANG:-$LOCALE.$ENCODING} "$@" -E $ENCODING } function initialize_database() { @@ -222,7 +225,16 @@ EOF function create_users() { if [[ ",$postinitdb_actions," = *,simple_db,* ]]; then createuser "$POSTGRESQL_USER" - createdb --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE" + + EXTRA_ARGS="" + if [ -v POSTGRESQL_ENCODING ]; then + EXTRA_ARGS="$EXTRA_ARGS -E $POSTGRESQL_ENCODING" + fi + if [ -v POSTGRESQL_LOCALE ]; then + EXTRA_ARGS="$EXTRA_ARGS -l $POSTGRESQL_LOCALE" + fi + + createdb $EXTRA_ARGS --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE" fi if [ -v POSTGRESQL_MASTER_USER ]; then