Skip to content

Commit 28971fe

Browse files
committed
Enhance environment configuration security and organization
This commit improves the configuration approach for development and production environments: - Add consistent profile variables for all development tools - Add explicit disabling settings in production for dev tools - Update Docker Compose profiles to use appropriate variables - Clean up and organize environment variables by function
1 parent cc648e9 commit 28971fe

File tree

4 files changed

+21
-31
lines changed

4 files changed

+21
-31
lines changed

.env

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
APP_NAME=docker_nginx_php_mysql
55
APP_WORKSPACE=default
66
APP_DIR=app
7-
APP_PUBLIC_DIR=$(APP_DIR)/public
7+
APP_PUBLIC_DIR=app/public
88

99
# Common settings
1010
NGINX_HOST=localhost
@@ -24,11 +24,7 @@ NGINX_SSL_KEY_SIZE=4096
2424
# PHP configuration
2525
PHP_VERSION=8.3
2626
PHP_TARGET=dev
27-
PHP_INI=php.prod.ini
28-
29-
PHP_DISPLAY_ERRORS=1
30-
PHP_MEMORY_LIMIT=256M
31-
XDEBUG_ENABLED=1
27+
PHP_INI=php.dev.ini
3228

3329
# MySQL configuration
3430
MYSQL_VERSION=9.2
@@ -41,18 +37,20 @@ MYSQL_USER=dev
4137
MYSQL_PASSWORD=dev
4238

4339
# PHPMyAdmin configuration
44-
PHPMYADMIN_PORT=8080
4540
PHPMYADMIN_PROFILE=dev
41+
PHPMYADMIN_PORT=8080
4642
PHPMYADMIN_USER=root
4743
PHPMYADMIN_PASSWORD=root
4844
PHPMYADMIN_UPLOAD_LIMIT=100M
4945

5046
# MailHog configuration
47+
MAILHOG_PROFILE=dev
5148
MAILHOG_SMTP_PORT=1025
5249
MAILHOG_UI_PORT=8025
5350
MAILHOG_STORAGE=memory
5451
MAILHOG_HOSTNAME=mailhog
5552
MAILHOG_CORS_ORIGIN=*
5653

5754
# API documentation configuration
55+
APIDOCS_PROFILE=dev
5856
APIDOCS_PORT=8081

.env.dev

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
APP_NAME=docker_nginx_php_mysql
55
APP_WORKSPACE=default
66
APP_DIR=app
7-
APP_PUBLIC_DIR=$(APP_DIR)/public
7+
APP_PUBLIC_DIR=app/public
88

99
# Common settings
1010
NGINX_HOST=localhost
@@ -26,10 +26,6 @@ PHP_VERSION=8.3
2626
PHP_TARGET=dev
2727
PHP_INI=php.dev.ini
2828

29-
PHP_DISPLAY_ERRORS=1
30-
PHP_MEMORY_LIMIT=256M
31-
XDEBUG_ENABLED=1
32-
3329
# MySQL configuration
3430
MYSQL_VERSION=9.2
3531
MYSQL_HOST=mysql
@@ -41,18 +37,20 @@ MYSQL_USER=dev
4137
MYSQL_PASSWORD=dev
4238

4339
# PHPMyAdmin configuration
44-
PHPMYADMIN_PORT=8080
4540
PHPMYADMIN_PROFILE=dev
41+
PHPMYADMIN_PORT=8080
4642
PHPMYADMIN_USER=root
4743
PHPMYADMIN_PASSWORD=root
4844
PHPMYADMIN_UPLOAD_LIMIT=100M
4945

5046
# MailHog configuration
47+
MAILHOG_PROFILE=dev
5148
MAILHOG_SMTP_PORT=1025
5249
MAILHOG_UI_PORT=8025
5350
MAILHOG_STORAGE=memory
5451
MAILHOG_HOSTNAME=mailhog
5552
MAILHOG_CORS_ORIGIN=*
5653

5754
# API documentation configuration
55+
APIDOCS_PROFILE=dev
5856
APIDOCS_PORT=8081

.env.prod

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
APP_NAME=docker_nginx_php_mysql
55
APP_WORKSPACE=default
66
APP_DIR=app
7-
APP_PUBLIC_DIR=$(APP_DIR)/public
7+
APP_PUBLIC_DIR=app/public
88

99
# Common settings
1010
NGINX_HOST=localhost
@@ -24,35 +24,33 @@ NGINX_SSL_KEY_SIZE=4096
2424
# PHP configuration
2525
PHP_VERSION=8.3
2626
PHP_TARGET=dev
27-
PHP_INI=php.prod.ini
28-
29-
PHP_DISPLAY_ERRORS=1
30-
PHP_MEMORY_LIMIT=256M
31-
XDEBUG_ENABLED=1
27+
PHP_INI=php.dev.ini
3228

3329
# MySQL configuration
3430
MYSQL_VERSION=9.2
3531
MYSQL_HOST=mysql
3632
MYSQL_PORT=8989
37-
MYSQL_DATABASE=test
38-
MYSQL_ROOT_USER=root
39-
MYSQL_ROOT_PASSWORD=root
40-
MYSQL_USER=dev
41-
MYSQL_PASSWORD=dev
33+
MYSQL_DATABASE=database_name
34+
MYSQL_ROOT_USER=app_root_user
35+
MYSQL_ROOT_PASSWORD=app_root_password
36+
MYSQL_USER=app_user
37+
MYSQL_PASSWORD=app_password
4238

4339
# PHPMyAdmin configuration
40+
PHPMYADMIN_PROFILE=none
4441
PHPMYADMIN_PORT=8080
45-
PHPMYADMIN_PROFILE=dev
4642
PHPMYADMIN_USER=root
4743
PHPMYADMIN_PASSWORD=root
4844
PHPMYADMIN_UPLOAD_LIMIT=100M
4945

5046
# MailHog configuration
47+
MAILHOG_PROFILE=none
5148
MAILHOG_SMTP_PORT=1025
5249
MAILHOG_UI_PORT=8025
5350
MAILHOG_STORAGE=memory
5451
MAILHOG_HOSTNAME=mailhog
5552
MAILHOG_CORS_ORIGIN=*
5653

5754
# API documentation configuration
55+
APIDOCS_PROFILE=none
5856
APIDOCS_PORT=8081

docker-compose.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ services:
7171
volumes:
7272
- "./etc/php/${PHP_INI:-php.dev.ini}:/usr/local/etc/php/conf.d/99-custom.ini"
7373
- "./web:/var/www/html"
74-
environment:
75-
- PHP_DISPLAY_ERRORS=${PHP_DISPLAY_ERRORS:-1}
76-
- PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT:-256M}
77-
- XDEBUG_ENABLED=${XDEBUG_ENABLED:-1}
7874
networks:
7975
- backend-network
8076
healthcheck:
@@ -120,7 +116,7 @@ services:
120116
networks:
121117
- backend-network
122118
profiles:
123-
- ${PHPMYADMIN_PROFILE:-dev}
119+
- ${MAILHOG_PROFILE:-dev}
124120

125121
apidocs:
126122
image: nginx:alpine
@@ -131,7 +127,7 @@ services:
131127
networks:
132128
- frontend-network
133129
profiles:
134-
- ${PHPMYADMIN_PROFILE:-dev}
130+
- ${APIDOCS_PROFILE:-dev}
135131

136132
volumes:
137133
mysql_data:

0 commit comments

Comments
 (0)