From 85198de04f2105344a7cc5a4c901b6a2cec2b35a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Blondel?= Date: Fri, 23 Feb 2018 17:52:39 +0100 Subject: [PATCH 1/2] Add Env Var to use an external configuration storage --- etc/phpmyadmin/config.inc.php | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/etc/phpmyadmin/config.inc.php b/etc/phpmyadmin/config.inc.php index 9ab1c973..aad74b31 100644 --- a/etc/phpmyadmin/config.inc.php +++ b/etc/phpmyadmin/config.inc.php @@ -13,7 +13,13 @@ 'PMA_PORTS', 'PMA_USER', 'PMA_PASSWORD', - 'PMA_ABSOLUTE_URI' + 'PMA_ABSOLUTE_URI', + 'PMA_CONTROLHOST', + 'PMA_CONTROLPORT', + 'PMA_PMADB', + 'PMA_CONTROLUSER', + 'PMA_CONTROLPASS', + 'PMA_QUERYHISTORYDB' ); foreach ($vars as $var) { $env = getenv($var); @@ -21,6 +27,9 @@ $_ENV[$var] = $env; } } +if (isset($_ENV['PMA_QUERYHISTORYDB'])) { + $cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']); +} /* Arbitrary server connection */ if (isset($_ENV['PMA_ARBITRARY']) && $_ENV['PMA_ARBITRARY'] === '1') { @@ -64,6 +73,30 @@ } else { $cfg['Servers'][$i]['auth_type'] = 'cookie'; } + $cfg['Servers'][$i]['controlhost'] = $_ENV['PMA_CONTROLHOST']; + $cfg['Servers'][$i]['controlport'] = $_ENV['PMA_CONTROLPORT']; + $cfg['Servers'][$i]['controluser'] = $_ENV['PMA_CONTROLUSER']; + $cfg['Servers'][$i]['controlpass'] = $_ENV['PMA_CONTROLPASS']; + $cfg['Servers'][$i]['pmadb'] = $_ENV['PMA_PMADB']; + $cfg['Servers'][$i]['relation'] = 'pma__relation'; + $cfg['Servers'][$i]['table_info'] = 'pma__table_info'; + $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords'; + $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages'; + $cfg['Servers'][$i]['column_info'] = 'pma__column_info'; + $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark'; + $cfg['Servers'][$i]['history'] = 'pma__history'; + $cfg['Servers'][$i]['recent'] = 'pma__recent'; + $cfg['Servers'][$i]['favorite'] = 'pma__favorite'; + $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs'; + $cfg['Servers'][$i]['tracking'] = 'pma__tracking'; + $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig'; + $cfg['Servers'][$i]['users'] = 'pma__users'; + $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups'; + $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding'; + $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches'; + $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns'; + $cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings'; + $cfg['Servers'][$i]['export_templates'] = 'pma__export_templates'; $cfg['Servers'][$i]['compress'] = false; $cfg['Servers'][$i]['AllowNoPassword'] = true; } From 93e2be73ecfb9b93f4473f3aa5a71052b4de5d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Blondel?= Date: Wed, 21 Mar 2018 10:55:33 +0100 Subject: [PATCH 2/2] check if the env is set --- etc/phpmyadmin/config.inc.php | 62 ++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/etc/phpmyadmin/config.inc.php b/etc/phpmyadmin/config.inc.php index aad74b31..f912b84b 100644 --- a/etc/phpmyadmin/config.inc.php +++ b/etc/phpmyadmin/config.inc.php @@ -73,32 +73,42 @@ } else { $cfg['Servers'][$i]['auth_type'] = 'cookie'; } - $cfg['Servers'][$i]['controlhost'] = $_ENV['PMA_CONTROLHOST']; - $cfg['Servers'][$i]['controlport'] = $_ENV['PMA_CONTROLPORT']; - $cfg['Servers'][$i]['controluser'] = $_ENV['PMA_CONTROLUSER']; - $cfg['Servers'][$i]['controlpass'] = $_ENV['PMA_CONTROLPASS']; - $cfg['Servers'][$i]['pmadb'] = $_ENV['PMA_PMADB']; - $cfg['Servers'][$i]['relation'] = 'pma__relation'; - $cfg['Servers'][$i]['table_info'] = 'pma__table_info'; - $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords'; - $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages'; - $cfg['Servers'][$i]['column_info'] = 'pma__column_info'; - $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark'; - $cfg['Servers'][$i]['history'] = 'pma__history'; - $cfg['Servers'][$i]['recent'] = 'pma__recent'; - $cfg['Servers'][$i]['favorite'] = 'pma__favorite'; - $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs'; - $cfg['Servers'][$i]['tracking'] = 'pma__tracking'; - $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig'; - $cfg['Servers'][$i]['users'] = 'pma__users'; - $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups'; - $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding'; - $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches'; - $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns'; - $cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings'; - $cfg['Servers'][$i]['export_templates'] = 'pma__export_templates'; - $cfg['Servers'][$i]['compress'] = false; - $cfg['Servers'][$i]['AllowNoPassword'] = true; + if (isset($_ENV['PMA_PMADB'])) { + $cfg['Servers'][$i]['pmadb'] = $_ENV['PMA_PMADB']; + $cfg['Servers'][$i]['relation'] = 'pma__relation'; + $cfg['Servers'][$i]['table_info'] = 'pma__table_info'; + $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords'; + $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages'; + $cfg['Servers'][$i]['column_info'] = 'pma__column_info'; + $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark'; + $cfg['Servers'][$i]['history'] = 'pma__history'; + $cfg['Servers'][$i]['recent'] = 'pma__recent'; + $cfg['Servers'][$i]['favorite'] = 'pma__favorite'; + $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs'; + $cfg['Servers'][$i]['tracking'] = 'pma__tracking'; + $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig'; + $cfg['Servers'][$i]['users'] = 'pma__users'; + $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups'; + $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding'; + $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches'; + $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns'; + $cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings'; + $cfg['Servers'][$i]['export_templates'] = 'pma__export_templates'; + $cfg['Servers'][$i]['compress'] = false; + $cfg['Servers'][$i]['AllowNoPassword'] = true; + } + if (isset($_ENV['PMA_CONTROLHOST'])) { + $cfg['Servers'][$i]['controlhost'] = $_ENV['PMA_CONTROLHOST']; + } + if (isset($_ENV['PMA_CONTROLPORT'])) { + $cfg['Servers'][$i]['controlport'] = $_ENV['PMA_CONTROLPORT']; + } + if (isset($_ENV['PMA_CONTROLUSER'])) { + $cfg['Servers'][$i]['controluser'] = $_ENV['PMA_CONTROLUSER']; + } + if (isset($_ENV['PMA_CONTROLPASS'])) { + $cfg['Servers'][$i]['controlpass'] = $_ENV['PMA_CONTROLPASS']; + } } /* * Revert back to last configured server to make