Skip to content

Commit e0dbb39

Browse files
sinclairpaulfrenck
andauthored
🔨 Add Upload limit option (#117)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
1 parent 9251d7d commit e0dbb39

File tree

6 files changed

+29
-5
lines changed

6 files changed

+29
-5
lines changed

‎phpmyadmin/DOCS.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ log_level: info
3030
3131
**Note**: _This is just an example, don't copy and paste it! Create your own!_
3232
33+
### Option: `upload_limit`
34+
35+
By default, the size limit for uploads (for operations such as imports) is set to
36+
64MB. This can be increased with this option, for example, `100` would be 100MB.
37+
3338
### Option: `log_level`
3439

3540
The `log_level` option controls the level of log output by the addon and can

‎phpmyadmin/config.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ services:
1919
hassio_api: true
2020
schema:
2121
log_level: list(trace|debug|info|notice|warning|error|fatal)?
22+
upload_limit: int?
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/with-contenv bashio
2+
# ==============================================================================
3+
# Home Assistant Community Add-on: phpMyAdmin
4+
# Configures nginx
5+
# ==============================================================================
6+
declare upload_limit
7+
8+
upload_limit="64M"
9+
10+
if bashio::config.has_value 'upload_limit'; then
11+
upload_limit=$(bashio::config "upload_limit")M
12+
fi
13+
14+
sed -i "s/%%upload_limit%%/${upload_limit}/g" \
15+
/etc/nginx/includes/server_params.conf

‎phpmyadmin/rootfs/etc/nginx/includes/server_params.conf‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ add_header X-Content-Type-Options nosniff;
66
add_header X-XSS-Protection "1; mode=block";
77
add_header X-Robots-Tag none;
88

9-
client_max_body_size 64M;
9+
client_max_body_size %%upload_limit%%;
1010

1111
location / {
1212
try_files $uri $uri/ /index.php?$query_string;

‎phpmyadmin/rootfs/etc/php8/conf.d/99-phpmyadmin.ini‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,5 @@ opcache.revalidate_freq=2
1111
opcache.validate_timestamps=0
1212
session.cookie_httponly=1
1313
session.use_strict_mode=1
14-
php_admin_value[post_max_size] = 64M
15-
php_admin_value[upload_max_filesize] = 64M
16-
17-
14+
post_max_size = ${UPLOAD_LIMIT}
15+
upload_max_filesize = ${UPLOAD_LIMIT}

‎phpmyadmin/rootfs/etc/services.d/php-fpm/run‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@ export SERVICE_HOST
99
export SERVICE_PASSWORD
1010
export SERVICE_PORT
1111
export SERVICE_USERNAME
12+
export UPLOAD_LIMIT=64M
1213

1314
SERVICE_HOST=$(bashio::services "mysql" "host")
1415
SERVICE_PASSWORD=$(bashio::services "mysql" "password")
1516
SERVICE_PORT=$(bashio::services "mysql" "port")
1617
SERVICE_USERNAME=$(bashio::services "mysql" "username")
1718

19+
if bashio::config.has_value 'upload_limit' ; then
20+
UPLOAD_LIMIT=$(bashio::config 'upload_limit')M
21+
fi
22+
1823
exec php-fpm8 --nodaemonize

0 commit comments

Comments
 (0)