forked from dockette/adminer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
76 lines (67 loc) · 3.34 KB
/
entrypoint.sh
File metadata and controls
76 lines (67 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
set -Eeo pipefail
if [ "${ADMINER_DEBUG}" = "1" ]; then
set -o xtrace
fi
# Banner
if [ "${ADMINER_BANNER}" != "0" ] && [ "${ADMINER_BANNER}" != "false" ] && [ "${ADMINER_BANNER}" != "no" ] && [ "${ADMINER_BANNER}" != "off" ]; then
cat << 'EOF'
█████╗ ██████╗ ███╗ ███╗██╗███╗ ██╗███████╗██████╗
██╔══██╗██╔══██╗████╗ ████║██║████╗ ██║██╔════╝██╔══██╗
███████║██║ ██║██╔████╔██║██║██╔██╗ ██║█████╗ ██████╔╝
██╔══██║██║ ██║██║╚██╔╝██║██║██║╚██╗██║██╔══╝ ██╔══██╗
██║ ██║██████╔╝██║ ╚═╝ ██║██║██║ ╚████║███████╗██║ ██║
╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝
EOF
fi
echo "[adminer] Loading Adminer..."
# Copy driver plugins from /srv/plugins/drivers to /srv/adminer-plugins
if [ -d "/srv/plugins/drivers" ]; then
cp -r /srv/plugins/drivers/* /srv/adminer-plugins/ 2>/dev/null || true
echo "[adminer] Driver plugins copied successfully."
else
echo "[adminer] No driver plugins directory found at /srv/plugins/drivers, skipping..."
fi
# Activate plugins (ADMINER_PLUGIN_<name>=1, all disabled by default)
if [ "${ADMINER_PLUGIN_AUTOLOGIN}" = "1" ]; then
cp /srv/plugins-available/adminer-autologin.php /srv/adminer-plugins/
echo "[adminer] Plugin 'autologin' activated."
elif [ "${ADMINER_PLUGIN_SERVER_LIST}" = "1" ]; then
cp /srv/plugins-available/adminer-server-list.php /srv/adminer-plugins/
echo "[adminer] Plugin 'server-list' activated."
fi
# Copy theme CSS files based on ADMINER_THEME environment variable
if [ -n "${ADMINER_THEME}" ]; then
THEME_DIR="/srv/designs/${ADMINER_THEME}"
if [ -d "${THEME_DIR}" ]; then
if [ -f "${THEME_DIR}/adminer.css" ]; then
cp "${THEME_DIR}/adminer.css" /srv/adminer.css
echo "[adminer] Theme '${ADMINER_THEME}' applied successfully."
else
echo "[adminer] Warning: Theme '${ADMINER_THEME}' does not contain adminer.css"
fi
if [ -f "${THEME_DIR}/adminer-dark.css" ]; then
cp "${THEME_DIR}/adminer-dark.css" /srv/adminer-dark.css
echo "[adminer] Dark mode CSS for theme '${ADMINER_THEME}' applied."
fi
else
echo "[adminer] Warning: Theme '${ADMINER_THEME}' not found in /srv/designs/"
echo "[adminer] Available themes:"
ls -1 /srv/designs/ 2>/dev/null || echo "[adminer] No themes available."
fi
fi
# Set default values if not provided
MEMORY=${MEMORY:-256M}
UPLOAD=${UPLOAD:-2048M}
PORT=${PORT:-80}
echo "[adminer] Starting PHP server (http://0.0.0.0:${PORT} in Docker):"
echo "-> memory_limit=${MEMORY}"
echo "-> upload_max_filesize=${UPLOAD}"
echo "-> post_max_size=${UPLOAD}"
echo "-> port=${PORT}"
# Execute PHP server
exec php \
-d "memory_limit=${MEMORY}" \
-d "upload_max_filesize=${UPLOAD}" \
-d "post_max_size=${UPLOAD}" \
-S "0.0.0.0:${PORT}"