Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(scripts): load chain env variables on demand #266

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,7 @@ get-artifacts-size:
scripts/check_artifacts_size.sh

get-pools CHAIN:
scripts/deployment/extract_pools.sh -c {{CHAIN}}
scripts/deployment/extract_pools.sh -c {{CHAIN}}

load CHAIN:
scripts/deployment/deploy_env/load_chain_env.sh {{CHAIN}}
28 changes: 28 additions & 0 deletions scripts/deployment/deploy_env/load_chain_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -e

project_root_path=$(realpath "$0" | sed 's|\(.*\)/.*|\1|' | cd ../ | pwd)

# Initializes chain env variables
function init_chain_env() {
if [ $# -eq 1 ]; then
local chain=$1
else
echo "init_chain_env requires a chain"
exit 1
fi

# Define the environment type based on the chain argument
local env_type="mainnets"
if [[ $chain == *"-testnet" ]]; then
env_type="testnets"
fi

source <(cat "$project_root_path"/scripts/deployment/deploy_env/"$env_type"/"${chain%-testnet}.env")

if [[ $chain != "chihuahua" && $chain != "injective" && $chain != "injective-testnet" && $chain != "migaloo" && $chain != "migaloo-testnet" ]]; then
source <(cat "$project_root_path"/scripts/deployment/deploy_env/base.env)
fi
}

init_chain_env $1
2 changes: 1 addition & 1 deletion scripts/deployment/deploy_env/mainnets/migaloo.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export CHAIN_ID="migaloo-1"
export DENOM="uwhale"
export BINARY="migalood"
export RPC="https://migaloo-rpc.polkachu.com:443"
export RPC="https://migaloo-rpc.polkachu.com:443"
Loading