Skip to content

Commit a69654e

Browse files
committed
Regenerate scripts/doc
1 parent d2dfe95 commit a69654e

File tree

8 files changed

+84
-8
lines changed

8 files changed

+84
-8
lines changed

10/root/usr/share/container-scripts/postgresql/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ initialization by passing `-e VAR=VALUE` to the Docker run command.
7474
**`POSTGRESQL_ADMIN_PASSWORD`**
7575
Password for the `postgres` admin account (optional)
7676

77+
The following environment variables are optional, and only used when the database is initialzed
78+
79+
**`POSTGRESQL_ENCODING`**
80+
Database encoding. Default to UTF8
81+
82+
**`POSTGRESQL_LOCALE`**
83+
Database locale. Default to en_US
7784

7885
Alternatively, the following options are related to migration scenario:
7986

10/root/usr/share/container-scripts/postgresql/common.sh

+14-2
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,10 @@ initdb_wrapper ()
189189
# Initialize the database cluster with utf8 support enabled by default.
190190
# This might affect performance, see:
191191
# http://www.postgresql.org/docs/10/static/locale.html
192-
LANG=${LANG:-en_US.utf8} "$@"
192+
ENCODING=${POSTGRESQL_ENCODING:-UTF8}
193+
LOCALE=${POSTGRESQL_LOCALE:-en_US}
194+
if [ ${LOCALE} == "C" ] ; then LANG=C; fi
195+
LANG=${LANG:-$LOCALE.$ENCODING} "$@" -E $ENCODING
193196
}
194197

195198
function initialize_database() {
@@ -222,7 +225,16 @@ EOF
222225
function create_users() {
223226
if [[ ",$postinitdb_actions," = *,simple_db,* ]]; then
224227
createuser "$POSTGRESQL_USER"
225-
createdb --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE"
228+
229+
EXTRA_ARGS=""
230+
if [ -v POSTGRESQL_ENCODING ]; then
231+
EXTRA_ARGS="$EXTRA_ARGS -E $POSTGRESQL_ENCODING"
232+
fi
233+
if [ -v POSTGRESQL_LOCALE ]; then
234+
EXTRA_ARGS="$EXTRA_ARGS -l $POSTGRESQL_LOCALE"
235+
fi
236+
237+
createdb $EXTRA_ARGS --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE"
226238
fi
227239

228240
if [ -v POSTGRESQL_MASTER_USER ]; then

12/root/usr/share/container-scripts/postgresql/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ initialization by passing `-e VAR=VALUE` to the Docker run command.
7474
**`POSTGRESQL_ADMIN_PASSWORD`**
7575
Password for the `postgres` admin account (optional)
7676

77+
The following environment variables are optional, and only used when the database is initialzed
78+
79+
**`POSTGRESQL_ENCODING`**
80+
Database encoding. Default to UTF8
81+
82+
**`POSTGRESQL_LOCALE`**
83+
Database locale. Default to en_US
7784

7885
Alternatively, the following options are related to migration scenario:
7986

12/root/usr/share/container-scripts/postgresql/common.sh

+14-2
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,10 @@ initdb_wrapper ()
189189
# Initialize the database cluster with utf8 support enabled by default.
190190
# This might affect performance, see:
191191
# http://www.postgresql.org/docs/12/static/locale.html
192-
LANG=${LANG:-en_US.utf8} "$@"
192+
ENCODING=${POSTGRESQL_ENCODING:-UTF8}
193+
LOCALE=${POSTGRESQL_LOCALE:-en_US}
194+
if [ ${LOCALE} == "C" ] ; then LANG=C; fi
195+
LANG=${LANG:-$LOCALE.$ENCODING} "$@" -E $ENCODING
193196
}
194197

195198
function initialize_database() {
@@ -222,7 +225,16 @@ EOF
222225
function create_users() {
223226
if [[ ",$postinitdb_actions," = *,simple_db,* ]]; then
224227
createuser "$POSTGRESQL_USER"
225-
createdb --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE"
228+
229+
EXTRA_ARGS=""
230+
if [ -v POSTGRESQL_ENCODING ]; then
231+
EXTRA_ARGS="$EXTRA_ARGS -E $POSTGRESQL_ENCODING"
232+
fi
233+
if [ -v POSTGRESQL_LOCALE ]; then
234+
EXTRA_ARGS="$EXTRA_ARGS -l $POSTGRESQL_LOCALE"
235+
fi
236+
237+
createdb $EXTRA_ARGS --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE"
226238
fi
227239

228240
if [ -v POSTGRESQL_MASTER_USER ]; then

13/root/usr/share/container-scripts/postgresql/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ initialization by passing `-e VAR=VALUE` to the Docker run command.
7474
**`POSTGRESQL_ADMIN_PASSWORD`**
7575
Password for the `postgres` admin account (optional)
7676

77+
The following environment variables are optional, and only used when the database is initialzed
78+
79+
**`POSTGRESQL_ENCODING`**
80+
Database encoding. Default to UTF8
81+
82+
**`POSTGRESQL_LOCALE`**
83+
Database locale. Default to en_US
7784

7885
Alternatively, the following options are related to migration scenario:
7986

13/root/usr/share/container-scripts/postgresql/common.sh

+14-2
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,10 @@ initdb_wrapper ()
189189
# Initialize the database cluster with utf8 support enabled by default.
190190
# This might affect performance, see:
191191
# http://www.postgresql.org/docs/13/static/locale.html
192-
LANG=${LANG:-en_US.utf8} "$@"
192+
ENCODING=${POSTGRESQL_ENCODING:-UTF8}
193+
LOCALE=${POSTGRESQL_LOCALE:-en_US}
194+
if [ ${LOCALE} == "C" ] ; then LANG=C; fi
195+
LANG=${LANG:-$LOCALE.$ENCODING} "$@" -E $ENCODING
193196
}
194197

195198
function initialize_database() {
@@ -222,7 +225,16 @@ EOF
222225
function create_users() {
223226
if [[ ",$postinitdb_actions," = *,simple_db,* ]]; then
224227
createuser "$POSTGRESQL_USER"
225-
createdb --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE"
228+
229+
EXTRA_ARGS=""
230+
if [ -v POSTGRESQL_ENCODING ]; then
231+
EXTRA_ARGS="$EXTRA_ARGS -E $POSTGRESQL_ENCODING"
232+
fi
233+
if [ -v POSTGRESQL_LOCALE ]; then
234+
EXTRA_ARGS="$EXTRA_ARGS -l $POSTGRESQL_LOCALE"
235+
fi
236+
237+
createdb $EXTRA_ARGS --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE"
226238
fi
227239

228240
if [ -v POSTGRESQL_MASTER_USER ]; then

15/root/usr/share/container-scripts/postgresql/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ initialization by passing `-e VAR=VALUE` to the Docker run command.
7474
**`POSTGRESQL_ADMIN_PASSWORD`**
7575
Password for the `postgres` admin account (optional)
7676

77+
The following environment variables are optional, and only used when the database is initialzed
78+
79+
**`POSTGRESQL_ENCODING`**
80+
Database encoding. Default to UTF8
81+
82+
**`POSTGRESQL_LOCALE`**
83+
Database locale. Default to en_US
7784

7885
Alternatively, the following options are related to migration scenario:
7986

15/root/usr/share/container-scripts/postgresql/common.sh

+14-2
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,10 @@ initdb_wrapper ()
189189
# Initialize the database cluster with utf8 support enabled by default.
190190
# This might affect performance, see:
191191
# http://www.postgresql.org/docs/15/static/locale.html
192-
LANG=${LANG:-en_US.utf8} "$@"
192+
ENCODING=${POSTGRESQL_ENCODING:-UTF8}
193+
LOCALE=${POSTGRESQL_LOCALE:-en_US}
194+
if [ ${LOCALE} == "C" ] ; then LANG=C; fi
195+
LANG=${LANG:-$LOCALE.$ENCODING} "$@" -E $ENCODING
193196
}
194197

195198
function initialize_database() {
@@ -222,7 +225,16 @@ EOF
222225
function create_users() {
223226
if [[ ",$postinitdb_actions," = *,simple_db,* ]]; then
224227
createuser "$POSTGRESQL_USER"
225-
createdb --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE"
228+
229+
EXTRA_ARGS=""
230+
if [ -v POSTGRESQL_ENCODING ]; then
231+
EXTRA_ARGS="$EXTRA_ARGS -E $POSTGRESQL_ENCODING"
232+
fi
233+
if [ -v POSTGRESQL_LOCALE ]; then
234+
EXTRA_ARGS="$EXTRA_ARGS -l $POSTGRESQL_LOCALE"
235+
fi
236+
237+
createdb $EXTRA_ARGS --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE"
226238
fi
227239

228240
if [ -v POSTGRESQL_MASTER_USER ]; then

0 commit comments

Comments
 (0)