From b0a8bc0bec362ee87fdb8d682c30d35591e5d11e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 14 Dec 2015 13:39:31 +0100 Subject: [PATCH] Add support for config auth method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #8 Signed-off-by: Michal Čihař --- README.md | 1 + config.inc.php | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6a6924b..55353ec 100644 --- a/README.md +++ b/README.md @@ -50,3 +50,4 @@ docker-compose up -d * ``PMA_ARBITRARY`` - when set to 1 connection to the arbitrary server will be allowed * ``PMA_HOST`` - define address/host name of the MySQL server * ``PMA_PORT`` - define port of the MySQL server +* ``PMA_USER`` and ``PMA_PASSWORD`` - define username to use for config authentication method diff --git a/config.inc.php b/config.inc.php index a855f67..e5bcc40 100644 --- a/config.inc.php +++ b/config.inc.php @@ -10,7 +10,6 @@ if (isset($_ENV['PMA_ARBITRARY']) && $_ENV['PMA_ARBITRARY'] === '1') { /* First server */ $i = 0; $i++; -$cfg['Servers'][$i]['auth_type'] = 'cookie'; if (isset($_ENV['PMA_HOST'])) { $cfg['Servers'][$i]['host'] = $_ENV['PMA_HOST']; } else { @@ -19,6 +18,13 @@ if (isset($_ENV['PMA_HOST'])) { if (isset($_ENV['PMA_PORT'])) { $cfg['Servers'][$i]['port'] = $_ENV['PMA_PORT']; } +if (isset($_ENV['PMA_USER']) && isset($_ENV['PMA_PASSWORD']) { + $cfg['Servers'][$i]['auth_type'] = 'config'; + $cfg['Servers'][$i]['user'] = $_ENV['PMA_USER']; + $cfg['Servers'][$i]['password'] = $_ENV['PMA_PASSWORD']; +} else { + $cfg['Servers'][$i]['auth_type'] = 'cookie'; +} $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; $cfg['Servers'][$i]['AllowNoPassword'] = true;