Skip to content

Commit

Permalink
feat: Enhance Template Generation Logic in OPENIM Deployment Scripts (#…
Browse files Browse the repository at this point in the history
…1510)

* feat: add  init-config.sh

* feat: add helm charts test cicd

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>

* feat: add helm charts test cicd

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>

* feat: add helm charts test cicd

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>

* feat: add helm charts test cicd

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>

---------

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
  • Loading branch information
cubxxw committed Dec 5, 2023
1 parent 4b19202 commit 1c1322e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 86 deletions.
1 change: 0 additions & 1 deletion .github/workflows/openimci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run OpenIM make install start
run: |
sudo make init && \
sudo make install
execute-scripts:
Expand Down
85 changes: 0 additions & 85 deletions config/prometheus.yml

This file was deleted.

12 changes: 12 additions & 0 deletions scripts/init-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,25 @@ 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..."
fi

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): "
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}"
Expand Down

0 comments on commit 1c1322e

Please sign in to comment.