chore(cli): support override file while installing

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
This commit is contained in:
rjshrjndrn 2024-02-02 20:24:15 +01:00
parent 621f63d90e
commit 1765c0b5bf

View file

@ -11,6 +11,8 @@ OR_REPO="${OR_REPO:-'https://github.com/openreplay/openreplay'}"
#OR_VERSION="dev"
# Only upgrade Openreplay
# UPGRADE_OR_ONLY=1 openreplay -u
# Pass override file to the installation
# OVERRIDE_FILE=override.yaml
[[ -d $OR_DIR ]] || {
sudo mkdir $OR_DIR
@ -244,6 +246,16 @@ function install() {
log title "Installing OpenReplay"
clone_repo
err_cd "$tmp_dir/openreplay/scripts/helmcharts"
# process override file while installing
# OVERRIDE_FILE=/tmp/override.yaml openreplay -i
[[ -z $OVERRIDE_FILE ]] || {
override_tmpdir=$(pwd)
err_cd /tmp
cp "$OVERRIDE_FILE" new_vars.yaml
cp "$override_tmpdir/vars.yaml" old_vars.yaml
yq '(load("old_vars.yaml") | .. | select(tag != "!!map" and tag != "!!seq")) as $i ireduce(.; setpath($i | path; $i))' new_vars.yaml >vars.yaml
mv vars.yaml "$override_tmpdir"
}
SKIP_K8S_TOOLS=1 DOMAIN_NAME=$domain_name bash init.sh
return
}