Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
gruberroland committed Nov 21, 2024
1 parent f7620d6 commit f257e9e
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions lam-packaging/docker/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# Docker start script for LDAP Account Manager

# This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
# Copyright (C) 2019 Felix Bartels
# Copyright (C) 2019 Felix Bartels
# 2019 - 2024 Roland Gruber

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -58,14 +59,14 @@ if [ "$LAM_SKIP_PRECONFIGURE" != "true" ]; then
LAM_CONFIGURATION_PASSWORD="${LAM_CONFIGURATION_PASSWORD:-}"

sed -i -f- /etc/ldap-account-manager/config.cfg <<- EOF
s|^password:.*|password: ${LAM_PASSWORD_SSHA}|;
s|^license:.*|license: ${LAM_LICENSE}|;
s|^configDatabaseType:.*|configDatabaseType: ${LAM_CONFIGURATION_DATABASE}|;
s|^configDatabaseServer:.*|configDatabaseServer: ${LAM_CONFIGURATION_HOST}|;
s|^configDatabasePort:.*|configDatabasePort: ${LAM_CONFIGURATION_PORT}|;
s|^configDatabaseName:.*|configDatabaseName: ${LAM_CONFIGURATION_DATABASE_NAME}|;
s|^configDatabaseUser:.*|configDatabaseUser: ${LAM_CONFIGURATION_USER}|;
s|^configDatabasePassword:.*|configDatabasePassword: ${LAM_CONFIGURATION_PASSWORD}|;
s|"password":"[^"]*"|"password":"${LAM_PASSWORD_SSHA}"|;
s|"license":"[^"]*"|"license":"${LAM_LICENSE}"|;
s|"configDatabaseType":"[^"]*"|"configDatabaseType":"${LAM_CONFIGURATION_DATABASE}"|;
s|"configDatabaseServer":"[^"]*"|"configDatabaseServer":"${LAM_CONFIGURATION_HOST}"|;
s|"configDatabasePort":"[^"]*"|"configDatabasePort":"${LAM_CONFIGURATION_PORT}"|;
s|"configDatabaseName":"[^"]*"|"configDatabaseName":"${LAM_CONFIGURATION_DATABASE_NAME}"|;
s|"configDatabaseUser":"[^"]*"|"configDatabaseUser":"${LAM_CONFIGURATION_USER}"|;
s|"configDatabasePassword":"[^"]*"|"configDatabasePassword":"${LAM_CONFIGURATION_PASSWORD}"|;
EOF
unset LAM_PASSWORD

Expand All @@ -79,13 +80,13 @@ EOF
fi

sed -i -f- /var/lib/ldap-account-manager/config/lam.conf <<- EOF
s|^ServerURL:.*|ServerURL: ${LDAP_SERVER}|;
s|^Admins:.*|Admins: ${LDAP_ADMIN_USER}|;
s|^Passwd:.*|Passwd: ${LAM_PASSWORD_SSHA}|;
s|^tools: treeViewSuffix:.*|tools: treeViewSuffix: ${LDAP_BASE_DN}|;
s|^defaultLanguage:.*|defaultLanguage: ${LAM_LANG}.utf8|;
s|^.*suffix_user:.*|types: suffix_user: ${LDAP_USERS_DN}|;
s|^.*suffix_group:.*|types: suffix_group: ${LDAP_GROUPS_DN}|;
s|"ServerURL":"[^"]*"|"ServerURL":"${LDAP_SERVER}"|;
s|"Admins":"[^"]*"|"Admins":"${LDAP_ADMIN_USER}"|;
s|"Passwd":"[^"]*"|"Passwd":"${LAM_PASSWORD_SSHA}"|;
s|"treeViewSuffix":"[^"]*"|"treeViewSuffix":"${LDAP_BASE_DN}"|;
s|"defaultLanguage":"[^"]*"|"defaultLanguage":"${LAM_LANG}.utf8"|;
s|"suffix_user":"[^"]*"|"suffix_user":"${LDAP_USERS_DN}"|;
s|"suffix_group":"[^"]*"|"suffix_group":"${LDAP_GROUPS_DN}"|;
EOF

fi
Expand Down

0 comments on commit f257e9e

Please sign in to comment.