From 5abb10794219823ab368dae9a4be21d7c7a49bf1 Mon Sep 17 00:00:00 2001 From: Timothy Clarke Date: Thu, 30 Aug 2018 14:25:31 +0100 Subject: [PATCH] Added ability to sepcifiy different values for ldap 'host' and 'name' useful for k8s which will often have different internal and external names --- README.md | 10 ++++++++++ image/service/phpldapadmin/startup.sh | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b6f796a..be7957b 100644 --- a/README.md +++ b/README.md @@ -170,6 +170,16 @@ See how to [set your own environment variables](#set-your-own-environment-variab To convert yaml to python online: http://yaml-online-parser.appspot.com/ + 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 + ```yaml + - Primary: + - server: + - host: ldap-master.example.org + - Backup: + - server: + - host: 192.168.0.100 + ``` + Apache : - **PHPLDAPADMIN_SERVER_ADMIN**: Server admin email. Defaults to `webmaster@example.org` - **PHPLDAPADMIN_SERVER_PATH**: Server path (usefull if behind a reverse proxy). Defaults to `/phpldapadmin` diff --git a/image/service/phpldapadmin/startup.sh b/image/service/phpldapadmin/startup.sh index e35222e..048971c 100755 --- a/image/service/phpldapadmin/startup.sh +++ b/image/service/phpldapadmin/startup.sh @@ -119,8 +119,10 @@ if [ ! -e "/var/www/phpldapadmin/config/config.php" ]; then hostname=$(complex-bash-env getRowKey "${!host}") info=$(complex-bash-env getRowValueVarName "${!host}") + if [ "${PHPLDAPADMIN_LDAP_HOSTS_FRIENDLY,,}" != "true" ]; then + append_to_file "\$servers->setValue('server','host','$hostname');" + fi append_to_file "\$servers->setValue('server','name','$hostname');" - append_to_file "\$servers->setValue('server','host','$hostname');" host_info "" "$info" else