forked from phpmyadmin/docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.inc.php
63 lines (54 loc) · 1.65 KB
/
config.inc.php
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
<?php
require('./config.secret.inc.php');
/* Ensure we got the environment */
$vars = array(
'PMA_ARBITRARY',
'PMA_HOST',
'PMA_HOSTS',
'PMA_PORT',
'PMA_USER',
'PMA_PASSWORD',
'PMA_ABSOLUTE_URI'
);
foreach ($vars as $var) {
if (!isset($_ENV[$var]) && getenv($var)) {
$_ENV[$var] = getenv($var);
}
}
/* Arbitrary server connection */
if (isset($_ENV['PMA_ARBITRARY']) && $_ENV['PMA_ARBITRARY'] === '1') {
$cfg['AllowArbitraryServer'] = true;
}
/* Play nice behind reverse proxys */
if (isset($_ENV['PMA_ABSOLUTE_URI'])) {
$cfg['PmaAbsoluteUri'] = trim($_ENV['PMA_ABSOLUTE_URI']);
}
/* Figure out hosts */
/* Fallback to default linked */
$hosts = array('db');
/* Set by environment */
if (!empty($_ENV['PMA_HOST'])) {
$hosts = array($_ENV['PMA_HOST']);
} elseif (!empty($_ENV['PMA_HOSTS'])) {
$hosts = explode(',', $_ENV['PMA_HOSTS']);
}
/* Server settings */
for ($i = 1; isset($hosts[$i - 1]); $i++) {
$cfg['Servers'][$i]['host'] = $hosts[$i - 1];
if (isset($_ENV['PMA_PORT'])) {
$cfg['Servers'][$i]['port'] = $_ENV['PMA_PORT'];
}
if (isset($_ENV['PMA_USER'])) {
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = $_ENV['PMA_USER'];
$cfg['Servers'][$i]['password'] = isset($_ENV['PMA_PASSWORD']) ? $_ENV['PMA_PASSWORD'] : null;
} else {
$cfg['Servers'][$i]['auth_type'] = 'cookie';
}
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = true;
}
/* Uploads setup */
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';