Skip to content

Commit 5abb107

Browse files
committed
Added ability to sepcifiy different values for ldap 'host' and 'name' useful for k8s which will often have different internal and external names
1 parent 887d2b6 commit 5abb107

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,16 @@ See how to [set your own environment variables](#set-your-own-environment-variab
170170

171171
To convert yaml to python online: http://yaml-online-parser.appspot.com/
172172

173+
If you would like to skip the display name == hostname element of the above use the **PHPLDAPADMIN_LDAP_HOSTS_FRIENDLY** environmental variable. This then uses the top most name as the display name of the server. You will then need to add host to the yaml within the server section. Note this is a global setting, if you do it for one server, you must do it for all. eg
174+
```yaml
175+
- Primary:
176+
- server:
177+
- host: ldap-master.example.org
178+
- Backup:
179+
- server:
180+
- host: 192.168.0.100
181+
```
182+
173183
Apache :
174184
- **PHPLDAPADMIN_SERVER_ADMIN**: Server admin email. Defaults to `webmaster@example.org`
175185
- **PHPLDAPADMIN_SERVER_PATH**: Server path (usefull if behind a reverse proxy). Defaults to `/phpldapadmin`

image/service/phpldapadmin/startup.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,10 @@ if [ ! -e "/var/www/phpldapadmin/config/config.php" ]; then
119119
hostname=$(complex-bash-env getRowKey "${!host}")
120120
info=$(complex-bash-env getRowValueVarName "${!host}")
121121

122+
if [ "${PHPLDAPADMIN_LDAP_HOSTS_FRIENDLY,,}" != "true" ]; then
123+
append_to_file "\$servers->setValue('server','host','$hostname');"
124+
fi
122125
append_to_file "\$servers->setValue('server','name','$hostname');"
123-
append_to_file "\$servers->setValue('server','host','$hostname');"
124126
host_info "" "$info"
125127

126128
else

0 commit comments

Comments
 (0)