Skip to content

Commit

Permalink
Add logic to prevent writing of database and email config files
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
skoranda committed Mar 16, 2020
1 parent e93e857 commit 83e8bfd
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
17 changes: 13 additions & 4 deletions comanage-registry-base/comanage_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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

Expand Down Expand Up @@ -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

Expand Down
22 changes: 22 additions & 0 deletions docs/comanage-registry-common-environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -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```

Expand Down

0 comments on commit 83e8bfd

Please sign in to comment.