-
Task
-
Resolution: Unresolved
-
Major
-
None
-
None
When comparing custom configuration mechanisms. I've found out that configure_s2i_files.sh will just replace the generated configuration, but on the other hand configure_custom_config.sh is able to expand selected variables via swapVars() function.
There're at least 2 problems:
- Custom script is more powerful, therefor same xml template doesn't work for both mechanisms currently
- swapVars is replacing just a selected set of configuration variables
- There should be probably a more generic replace mechanism that is able to expand any of the config variables (a separate issue to be raised for it?)
#!/bin/sh
set -e
INSTANCE_DIR=$1
echo "Copying Config files from S2I build"
cp -v $AMQ_HOME/conf/* ${INSTANCE_DIR}/etc/
#!/bin/sh set -e INSTANCE_DIR=$1 DISABLER_TAG="<!-- Remove this tag to enable custom configuration -->" declare -a CONFIG_FILES=("BROKER_XML" "LOGGING_PROPERTIES") function swapVars() { sed -i "s/\${BROKER_IP}/$BROKER_IP/g" $1 sed -i "s/\${AMQ_NAME}/$AMQ_NAME/g" $1 sed -i "s/\${AMQ_ROLE}/$AMQ_ROLE/g" $1 sed -i "s/\${AMQ_STORAGE_USAGE_LIMIT}/$AMQ_STORAGE_USAGE_LIMIT/g" $1 } for config_file in ${CONFIG_FILES[@]}; do file_text="${!config_file}" file_text=$(echo "$file_text" | sed "/^$/d") # Remove empty lines # Format env var into filename fname=$(echo "$config_file" | tr '[:upper:]' '[:lower:]' | sed -e 's/_/./g') #If file_text has disabler tag or is an empty/whitspace string if echo "$file_text" | grep -q "$DISABLER_TAG" || [[ -z "${file_text// }" ]]; then echo "Custom Configuration file '$config_file' is disabled" else echo "Custom Configuration file '$config_file' is enabled" # Overwrite default configuration file echo "$file_text" > $INSTANCE_DIR/etc/$fname fi # Swap env vars into configuration file swapVars $INSTANCE_DIR/etc/$fname done
- clones
-
ENTMQBR-1651 configuration via s2i vs. custom BROKER_XML is inconsistent
- New