diff options
Diffstat (limited to 'config.inc.php-dist')
-rw-r--r-- | config.inc.php-dist | 119 |
1 files changed, 46 insertions, 73 deletions
diff --git a/config.inc.php-dist b/config.inc.php-dist index 76e089af..1991083b 100644 --- a/config.inc.php-dist +++ b/config.inc.php-dist @@ -1,80 +1,46 @@ <?php -// Allows to load yaml config. Matching keys will override config defined in this file + +/** + * PHPPgAdmin 6.0.0 + */ + use Symfony\Component\Yaml\Yaml; $conf = [ /** * Change this parameter ONLY if you mean to serve phpPgAdmin from a subfolder * e.g for `https://www.server.com/phppga` this parameter should be `/phppga` - * (leading slash, no trailing slash) - * + * (leading slash, no trailing slash). + * * If you mean to serve phpPgAdmin6 in the document root (e.g `https://www.server.com`) * this parameter must be an empty string */ - 'subfolder' => '', - - /** - * enable this to calculate schema and table sizes. This will have a performance impact - * e.g. $conf['display_sizes'] = true - * - * you can also enable it specifically for tables and or schemas: - * $conf['display_sizes'] = ['schemas'=>false,'tables'=>true]; - */ - 'display_sizes' => false, + 'subfolder' => '', - /** - * Set to true if you want to enable debugging output - */ - 'debugmode' => false, + /** + * enable this to calculate schema and table sizes. This will have a performance impact + * e.g. $conf['display_sizes'] = true. + * + * you can also enable it specifically for tables and or schemas: + * $conf['display_sizes'] = ['schemas'=>false,'tables'=>true]; + */ + 'display_sizes' => false, /** - * Don't touch this value. It's used to inform the config structure has a breaking change - * + * Set to true if you want to enable debugging output. */ - 'version'=> 61 + 'debugmode' => false, + /** + * Don't touch this value. It's used to inform the config structure has a breaking change. + */ + 'version' => 61, ]; -$conf['register_debuggers'] = function () { - // If debugmode is active, and $conf['register_debuggers'] - // is a function (or a callable), it will be invoked before - // instancing the app's container - define('THIS_WAS_PRODUCTION', false); - // e.g. register Whoops as exception handler - if (THIS_WAS_PRODUCTION - && class_exists('Whoops\Run')) { - $whoops = new Whoops\Run(); - $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler()); - $whoops->register(); - } - - // Using PHP-Console - // PHP_CONSOLE doesn't work on PHP 7.4 yet - // https://github.com/barbushin/php-console - // (Only in Chrome) - if (THIS_WAS_PRODUCTION && - version_compare(PHP_VERSION, 7.4, '<') && - class_exists('PhpConsole\Handler')) { - $phpConsoleHandler = \PhpConsole\Handler::getInstance(); - $connector = $phpConsoleHandler->getConnector(); - $connector->setPassword('yohoho123', true); - $connector->enableSslOnlyMode(); - $phpConsoleHandler->start(); - } - - // Example with Kint - if (THIS_WAS_PRODUCTION && - class_exists('Kint')) { - \Kint::$enabled_mode = true; - \Kint\Renderer\RichRenderer::$folder = false; - function ddd(...$v) - { - \Kint::dump(...$v); - exit; - } - - \Kint::$aliases[] = 'ddd'; - } +// Two debug library examples. Pick one of course. +$conf['register_debuggers'] = static function (): void { + //require_once __DIR__ . '/.configs/debug.kint.php'; + //require_once __DIR__ . '/.configs/debug.var_dumper.php'; }; // optionally, set a path for your error log, relative to this project root @@ -86,36 +52,40 @@ $server_index = 0; /** * $conf['servers'] is an array that holds (at least) one server block. + * * @see https://github.com/HuasoFoundries/phpPgAdmin6/wiki/Config:-servers - * */ $conf['servers'][$server_index] = [ // Display name for the server on the login screen - 'desc' => 'PostgreSQL', + 'desc' => 'PostgreSQL', // Hostname or IP address for server. Use '' for UNIX domain socket. // use 'localhost' for TCP/IP connection on this computer - 'host' => '', + 'host' => '', // Database port on server (5432 is the PostgreSQL default) - 'port' => 5432, + 'port' => 5432, // Database SSL mode // Possible options: disable, allow, prefer, require // To require SSL on older servers use option: legacy // To ignore the SSL mode, use option: unspecified - 'sslmode' => 'allow', + 'sslmode' => 'allow', // Change the default database only if you cannot connect to template1. // For a PostgreSQL 8.1+ server, you can set this to 'postgres'. - 'defaultdb' => 'template1', + 'defaultdb' => 'template1', // Specify the path to the database dump utilities for this server. // You can set these to '' if no dumper is available. - 'pg_dump_path' => '/usr/bin/pg_dump', - 'pg_dumpall_path' => '/usr/bin/pg_dumpall' + 'pg_dump_path' => '/usr/bin/pg_dump', + 'pg_dumpall_path' => '/usr/bin/pg_dumpall', ]; +// Server group 0 will show up with an alias +$conf['srv_groups'][0]['desc'] = 'dev1 and prod2'; +// Add here servers indexes belonging to the group '0' seperated by comma +$conf['srv_groups'][0]['servers'] = '1,3'; // Default language. E.g.: 'english', 'polish', etc. See lang/ directory // for all possibilities. If you specify 'auto' (the default) it will use @@ -188,30 +158,33 @@ $conf['ajax_refresh'] = 3; // If there's a config.yml in the root folder, parse it and merge its contents with $conf array // see config.example.yml -$yamlConfigPath = implode(DIRECTORY_SEPARATOR, [__DIR__, 'config.yml']); +$yamlConfigPath = \implode(\DIRECTORY_SEPARATOR, [__DIR__, 'config.yml']); + if (\is_readable($yamlConfigPath) && \class_exists('Symfony\Component\Yaml\Yaml')) { try { - $yamlConfig = Symfony\Component\Yaml\Yaml::parseFile($yamlConfigPath); + $yamlConfig = Yaml::parseFile($yamlConfigPath); // Servers and srv_groups must be merged beforehand $servers = $conf['servers'] ?? []; + foreach ($yamlConfig['servers'] ?? [] as $index => $srv) { $servers[] = $srv; } $srv_groups = $conf['srv_groups'] ?? []; + foreach ($yamlConfig['srv_groups'] ?? [] as $index => $srv_group) { $srv_groups[] = $srv; } - $yamlConfig['srv_groups'] = array_merge([ + $yamlConfig['srv_groups'] = \array_merge([ $conf['srv_groups'] ?? [], $yamlConfig['srv_groups'] ?? [], ]); $conf = \array_merge($conf, $yamlConfig); - $conf['servers'] = $servers ?? []; + $conf['servers'] = $servers ?? []; $conf['srv_groups'] = $srv_groups ?? []; } catch (\Exception $e) { die($e->getMessage()); \error_log($e->getTraceAsString()); } -}
\ No newline at end of file +} |