From 83e8bfd173755280d296953249de2d881a543551 Mon Sep 17 00:00:00 2001 From: Scott Koranda Date: Mon, 16 Mar 2020 15:47:59 -0500 Subject: [PATCH] Add logic to prevent writing of database and email config files Add logic so that if the environment variable COMANAGE_REGISTRY_NO_DATABASE_CONFIG exists then the entrypoint script will not attempt to create the database.php file. Likewise if COMANAGE_REGISTRY_NO_EMAIL_CONFIG exists then the entrypoint script will not attempt to create the email.php file. --- comanage-registry-base/comanage_utils.sh | 17 ++++++++++---- ...e-registry-common-environment-variables.md | 22 +++++++++++++++++++ 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/comanage-registry-base/comanage_utils.sh b/comanage-registry-base/comanage_utils.sh index eb82dfc..ea4ed3a 100644 --- a/comanage-registry-base/comanage_utils.sh +++ b/comanage-registry-base/comanage_utils.sh @@ -99,6 +99,8 @@ function comanage_utils::consume_injected_environment() { COMANAGE_REGISTRY_EMAIL_PORT COMANAGE_REGISTRY_EMAIL_ACCOUNT COMANAGE_REGISTRY_EMAIL_ACCOUNT_PASSWORD + COMANAGE_REGISTRY_NO_DATABASE_CONFIG + COMANAGE_REGISTRY_NO_EMAIL_CONFIG COMANAGE_REGISTRY_SECURITY_SALT COMANAGE_REGISTRY_SECURITY_SEED COMANAGE_REGISTRY_VIRTUAL_HOST_FQDN @@ -192,7 +194,8 @@ function comanage_utils::enable_plugins() { ########################################## # Exec to start and become Apache HTTP Server # Globals: -# None +# COMANAGE_REGISTRY_NO_DATABASE_CONFIG +# COMANAGE_REGISTRY_NO_EMAIL_CONFIG # Arguments: # Command and arguments to exec # Returns: @@ -206,9 +209,13 @@ function comanage_utils::exec_apache_http_server() { comanage_utils::prepare_local_directory - comanage_utils::prepare_database_config + if [[ -z ${COMANAGE_REGISTRY_NO_DATABASE_CONFIG} ]]; then + comanage_utils::prepare_database_config + fi - comanage_utils::prepare_email_config + if [[ -z ${COMANAGE_REGISTRY_NO_EMAIL_CONFIG} ]]; then + comanage_utils::prepare_email_config + fi comanage_utils::prepare_https_cert_key @@ -251,7 +258,9 @@ function comanage_utils::exec_cron() { comanage_utils::prepare_local_directory - comanage_utils::prepare_database_config + if [[ -z ${COMANAGE_REGISTRY_NO_DATABASE_CONFIG} ]]; then + comanage_utils::prepare_database_config + fi comanage_utils::wait_database_connectivity diff --git a/docs/comanage-registry-common-environment-variables.md b/docs/comanage-registry-common-environment-variables.md index b29b017..4229bdd 100644 --- a/docs/comanage-registry-common-environment-variables.md +++ b/docs/comanage-registry-common-environment-variables.md @@ -161,6 +161,28 @@ provided that the file it points to exists and is readable. * Default: none * Example: IdentifierEnroller,LdapIdentifierValidator,MailmanProvisioner +```COMANAGE_REGISTRY_NO_DATABASE_CONFIG``` + +* Description: Do not write a database configuration file if environment variable is set. +* Required: no +* Default: not set +* Example: 1 +* Note: If the environment variable is set to any value then the entrypoint script will +not attempt to write the database configuration file ```database.php```. This +environment variable is often used with the `comanage-registry-cron` image when it +shares a bind mounted directory with the COmanage Registry image. + +```COMANAGE_REGISTRY_NO_EMAIL_CONFIG``` + +* Description: Do not write an email configuration file if environment variable is set. +* Required: no +* Default: not set +* Example: 1 +* Note: If the environment variable is set to any value then the entrypoint script will +not attempt to write the email configuration file ```email.php```. This +environment variable is often used with the `comanage-registry-cron` image when it +shares a bind mounted directory with the COmanage Registry image. + ```COMANAGE_REGISTRY_SECURITY_SALT```