-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpma-config.tmpl
59 lines (46 loc) · 1.87 KB
/
pma-config.tmpl
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
{{ $currentContainer := where $ "ID" .Docker.CurrentContainerID | first }}
{{ $currentContainerNetworks := groupByKeys $currentContainer.Networks ".Name"}}
<?php
require('/etc/phpmyadmin/config.secret.inc.php');
$i = 1;
{{range $container := .}}
{{ $containerNetworks := groupByKeys $container.Networks ".Name"}}
{{if and (intersect $containerNetworks $currentContainerNetworks) (ne $currentContainer.ID $container.ID) ($container.Env.MYSQL_ROOT_PASSWORD)}}
$cfg['Servers'][$i]['host'] = "{{ $container.Name }}";
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Servers'][$i]['auth_type'] = 'config';
{{if $container.Env.PMA_USER}}
$cfg['Servers'][$i]['user'] = '{{ $container.Env.PMA_USER }}';
{{else}}
$cfg['Servers'][$i]['user'] = 'root';
{{end}}
{{if $container.Env.PMA_PASS}}
$cfg['Servers'][$i]['password'] = '{{ $container.Env.PMA_PASS }}';
{{else}}
$cfg['Servers'][$i]['password'] = '{{ $container.Env.MYSQL_ROOT_PASSWORD }}';
{{end}}
{{if $container.Env.PMA_VERBOSE}}
$cfg['Servers'][$i]['verbose'] = '{{ $container.Env.PMA_VERBOSE }}';
{{end}}
{{if $container.Env.PMA_ONLYDB}}
$cfg['Servers'][$i]['only_db'] = explode('|', '{{ $container.Env.PMA_ONLYDB }}');
{{end}}
$i++;
{{end}}
{{end}}
if ($i == 1) {
die("No MYSQL servers found");
} else if ($i > 2) {
$cfg['ServerDefault'] = 0;
}
/* Uploads setup */
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
$cfg['FirstLevelNavigationItems'] = 250;
$cfg['MaxNavigationItems'] = 500;
/* Include User Defined Settings Hook */
if (file_exists('/etc/phpmyadmin/config.user.inc.php')) {
include('/etc/phpmyadmin/config.user.inc.php');
}