-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: adds a script to install a local alias to load env variables on d…
…emand
- Loading branch information
Showing
4 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
|
||
project_root_path=$(realpath "$0" | sed 's|\(.*\)/.*|\1|' | cd ../ | pwd) | ||
|
||
# Function definition to append, including the load alias | ||
loadenv_function=" | ||
#cosmos chains env loader | ||
alias load='load_chain_env' | ||
load_chain_env() { | ||
if [ -z \"\$1\" ]; then | ||
echo \"Please specify the chain to load (e.g., migaloo, terra...)\" | ||
else | ||
source "${project_root_path}"/scripts/deployment/deploy_env/chain_env.sh | ||
init_chain_env \"\$1\" | ||
fi | ||
} | ||
" | ||
|
||
# Potential shell configuration files | ||
bashrc="$HOME/.bashrc" | ||
zshrc="$HOME/.zshrc" | ||
profile="$HOME/.profile" | ||
|
||
# Append the function to Bash and Zsh configuration files if they exist | ||
[[ -f "$bashrc" ]] && echo "$loadenv_function" >>"$bashrc" && echo "Added to $bashrc" | ||
[[ -f "$zshrc" ]] && echo "$loadenv_function" >>"$zshrc" && echo "Added to $zshrc" | ||
[[ -f "$profile" ]] && echo "$loadenv_function" >>"$profile" && echo "Added to $profile" | ||
|
||
echo "Now you can load chains env variables by doing 'load <chain>' in your terminal." | ||
echo "To see a list of compatible chains look into chain_env.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters