Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f48a57c

Browse files
committed
Add support for locale and encoding, fix #406
1 parent 83c71ac commit f48a57c

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

‎src/root/usr/share/container-scripts/postgresql/README.md‎

Lines changed: 7 additions & 0 deletions
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 UTF-8
81+
82+
**`POSTGRESQL_LOCALE`**
83+
Database locale. Default to en_EN
7784

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

‎src/root/usr/share/container-scripts/postgresql/common.sh‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,15 @@ EOF
223223
function create_users() {
224224
if [[ ",$postinitdb_actions," = *,simple_db,* ]]; then
225225
createuser "$POSTGRESQL_USER"
226-
createdb --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE"
226+
EXTRA_ARGS=""
227+
if [ -v POSTGRESQL_ENCODING ]; then
228+
EXTRA_ARGS="$EXTRA_ARGS -E $POSTGRESQL_ENCODING"
229+
fi
230+
if [ -v POSTGRESQL_LOCALE ]; then
231+
EXTRA_ARGS="$EXTRA_ARGS -l $POSTGRESQL_LOCALE"
232+
fi
233+
234+
createdb $EXTRA_ARGS --owner="$POSTGRESQL_USER" "$POSTGRESQL_DATABASE"
227235
fi
228236

229237
if [ -v POSTGRESQL_MASTER_USER ]; then

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /