diff --git a/scripts/init-config.sh b/scripts/init-config.sh index a4672c62d..2c222e262 100755 --- a/scripts/init-config.sh +++ b/scripts/init-config.sh @@ -35,6 +35,8 @@ declare -A TEMPLATES=( ["${OPENIM_ROOT}/deployments/templates/alertmanager.yml"]="${OPENIM_ROOT}/config/alertmanager.yml" ) +openim::log::info "Read more configuration information: https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md" + for template in "${!TEMPLATES[@]}"; do if [[ ! -f "${template}" ]]; then openim::log::error_exit "template file ${template} does not exist..." @@ -42,6 +44,16 @@ for template in "${!TEMPLATES[@]}"; do IFS=';' read -ra OUTPUT_FILES <<< "${TEMPLATES[$template]}" for output_file in "${OUTPUT_FILES[@]}"; do + if [[ -f "${output_file}" ]]; then + read -p "File ${output_file} already exists. Overwrite? (Y/N): " -r + if [[ $REPLY =~ ^[Yy]$ ]]; then + openim::log::info "Overwriting ${output_file}. Previous configuration will be lost." + else + openim::log::info "Skipping generation of ${output_file}." + continue + fi + fi + openim::log::info "⌚ Working with template file: ${template} to ${output_file}..." "${OPENIM_ROOT}/scripts/genconfig.sh" "${ENV_FILE}" "${template}" > "${output_file}" || { openim::log::error "Error processing template file ${template}"