Skip to content

Commit ad26301

Browse files
committed
added envsubst command
1 parent e3fe153 commit ad26301

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

cakephp/html/app_local.php renamed to cakephp/html/app_local.php.template

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* You should treat it as extremely sensitive data.
2626
*/
2727
'Security' => [
28-
'salt' => env('SECURITY_SALT', '__SALT__'),
28+
'salt' => env('SECURITY_SALT', '$RANDOM_VALUE'),
2929
],
3030

3131
/*
@@ -62,10 +62,10 @@
6262
*/
6363
//'port' => 'non_standard_port_number',
6464

65-
'username' => 'DB_USER',
66-
'password' => 'DB_PASSWORD',
65+
'username' => '${DB_USER}',
66+
'password' => '${DB_PASSWORD}',
6767

68-
'database' => 'DB_NAME',
68+
'database' => '${DB_NAME}',
6969
/*
7070
* If not using the default 'public' schema with the PostgreSQL driver
7171
* set it here.

docker-compose.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,16 @@ services:
3232
retries: 6
3333
start_period: 60s
3434
environment:
35+
DB_USER: '${DB_USER}'
36+
DB_PASSWORD: '${DB_PASSWORD}'
37+
DB_NAME: '${DB_NAME}'
3538
TZ: '${LOCAL_TIMEZONE}'
3639
labels:
3740
- 'docker-volume-backup.stop-during-backup=true'
3841
command: >
39-
bash -c "apt-get -y update && apt-get install -y zip unzip libicu-dev && docker-php-ext-install pdo_mysql intl && if pecl install -p -- redis; then pecl install -o -f redis && rm -rf /tmp/pear && docker-php-ext-enable redis; fi; curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer
40-
&& if [ -f \"/app/basic/config/app_local.php\" ]; then composer update --prefer-dist cakephp/cakephp:~4.0 --working-dir=/app/basic --no-interaction --ignore-platform-req=ext-intl; else composer create-project --prefer-dist cakephp/app:~4.0 basic --working-dir=/app --no-interaction --ignore-platform-req=ext-intl; fi
41-
&& sed \"s/DB_USER/${DB_USER}/;s/DB_PASSWORD/${DB_PASSWORD}/;s/DB_NAME/${DB_NAME}/;s/__SALT__/$$(tr -dc '[:alnum:]' </dev/urandom | head -c 32)/\" ${WEBSERVER_DOC_ROOT}/app_local.php > /app/basic/config/app_local.php;
42+
bash -c "apt-get -y update && apt-get install -y zip unzip libicu-dev gettext-base && docker-php-ext-install pdo_mysql intl && if pecl install -p -- redis; then pecl install -o -f redis && rm -rf /tmp/pear && docker-php-ext-enable redis; fi; curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer &&
43+
if [ -f \"/app/basic/config/app_local.php\" ]; then composer update --prefer-dist cakephp/cakephp:~4.0 --working-dir=/app/basic --no-interaction --ignore-platform-req=ext-intl; else composer create-project --prefer-dist cakephp/app:~4.0 basic --working-dir=/app --no-interaction --ignore-platform-req=ext-intl; fi &&
44+
export RANDOM_VALUE=$(tr -dc '[:alnum:]' </dev/urandom | head -c 32) && envsubst '$${DB_USER},$${DB_PASSWORD},$${DB_NAME},$$RANDOM_VALUE' < ${WEBSERVER_DOC_ROOT}/app_local.php.template > /app/basic/config/app_local.php &&
4245
grep -qe 'date.timezone = ${LOCAL_TIMEZONE}' ${PHP_INI_DIR_PREFIX}/php/conf.d/security.ini || echo 'date.timezone = ${LOCAL_TIMEZONE}' >> ${PHP_INI_DIR_PREFIX}/php/conf.d/security.ini; php-fpm"
4346
4447
webserver:

phpmyadmin/config.user.inc.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@
99

1010
$cfg['CheckConfigurationPermissions'] = false;
1111
$cfg['ShowPhpInfo'] = true;
12-
$cfg['Servers'][1]['host'] = 'database';

0 commit comments

Comments
 (0)