apache_conf 使用PhpPgMyAdmin检测docker postgres实例
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apache_conf 使用PhpPgMyAdmin检测docker postgres实例相关的知识,希望对你有一定的参考价值。
<?php
# phppgmyadmin/conf/config.inc.php
(...)
// Docker postgres connections
$server_i = 1;
$containers = explode("\n", trim(`docker ps`));
array_shift($containers);
foreach ($containers as $cid) {
if (!preg_match('/postgres/', $cid)) { continue; }
$cid = substr($cid, 0, 12);
$container = json_decode(`docker inspect {$cid}`);
if ($container) {
$container = $container[0];
$port = array_keys((Array)$container->NetworkSettings->Ports)[0];
$port = +explode('/', $port, 2)[0];
$conf['servers'][$server_i]['desc'] = substr($container->Name, 1);
$conf['servers'][$server_i]['host'] = $container->NetworkSettings->IPAddress;
$conf['servers'][$server_i]['port'] = $port;
$conf['servers'][$server_i]['sslmode'] = 'allow';
$conf['servers'][$server_i]['defaultdb'] = 'template1';
$conf['servers'][$server_i]['pg_dump_path'] = '/usr/bin/pg_dump';
$conf['servers'][$server_i]['pg_dumpall_path'] = '/usr/bin/pg_dumpall';
$server_i++;
}
}
以上是关于apache_conf 使用PhpPgMyAdmin检测docker postgres实例的主要内容,如果未能解决你的问题,请参考以下文章
apache_conf 使用.htaccess强制HTTPS
apache_conf 使用.htaccess强制HTTPS
apache_conf 使用.htaccess强制下载文件
apache_conf 使用nconf管理分层配置
apache_conf 禁止使用IP没有deseadas
apache_conf 如何使用.htaccess文件强制HTTPS