mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-03 19:02:31 +08:00
feat: add init-config.sh
This commit is contained in:
parent
4b192027aa
commit
a40f4433b8
@ -35,6 +35,8 @@ declare -A TEMPLATES=(
|
|||||||
["${OPENIM_ROOT}/deployments/templates/alertmanager.yml"]="${OPENIM_ROOT}/config/alertmanager.yml"
|
["${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
|
for template in "${!TEMPLATES[@]}"; do
|
||||||
if [[ ! -f "${template}" ]]; then
|
if [[ ! -f "${template}" ]]; then
|
||||||
openim::log::error_exit "template file ${template} does not exist..."
|
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]}"
|
IFS=';' read -ra OUTPUT_FILES <<< "${TEMPLATES[$template]}"
|
||||||
for output_file in "${OUTPUT_FILES[@]}"; do
|
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::log::info "⌚ Working with template file: ${template} to ${output_file}..."
|
||||||
"${OPENIM_ROOT}/scripts/genconfig.sh" "${ENV_FILE}" "${template}" > "${output_file}" || {
|
"${OPENIM_ROOT}/scripts/genconfig.sh" "${ENV_FILE}" "${template}" > "${output_file}" || {
|
||||||
openim::log::error "Error processing template file ${template}"
|
openim::log::error "Error processing template file ${template}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user