From e8b7b42b899e443d99ef4c22b17c9a77ecd7d068 Mon Sep 17 00:00:00 2001 From: ingalls Date: Wed, 13 Nov 2024 13:38:45 -0700 Subject: [PATCH] Add ForceNewConfig option --- cloudformation/lib/api.js | 7 +++++++ start | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/cloudformation/lib/api.js b/cloudformation/lib/api.js index df96c3d..d916594 100644 --- a/cloudformation/lib/api.js +++ b/cloudformation/lib/api.js @@ -8,6 +8,12 @@ export default { AllowedValues: [ 'true', 'false' ], Default: false }, + ForceNewConfig: { + Description: 'Force a blank config file - permanently deleting current config', + Type: 'String', + AllowedValues: ['true', 'false'], + Default: 'false' + }, SSLCertificateIdentifier: { Description: 'ACM SSL Certificate for HTTP Protocol', Type: 'String' @@ -247,6 +253,7 @@ export default { }], Environment: [ { Name: 'StackName', Value: cf.stackName }, + { Name: 'FORCE_NEW_CONFIG', Value: cf.ref('ForceNewConfig') }, { Name: 'AWS_DEFAULT_REGION', Value: cf.region }, { Name: 'LDAP_ORGANISATION', Value: cf.ref('LDAPOrganisation') }, { Name: 'LDAP_DOMAIN', Value: cf.ref('LDAPDomain') }, diff --git a/start b/start index c3d038a..af9f986 100755 --- a/start +++ b/start @@ -2,6 +2,11 @@ set -euo pipefail +if [[ ${FORCE_NEW_CONFIG} == "true" ]]; then + rm -rf "/var/lib/ldap/*" + rm -rf "/etc/ldap/slapd.d/*" +fi + echo "Generating LDIF" echo "Domain: ${LDAP_DOMAIN}"