Skip to content

Commit

Permalink
feat: added db env
Browse files Browse the repository at this point in the history
  • Loading branch information
keenahn committed Mar 22, 2024
1 parent 76d2e51 commit 68eb4d3
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion custom/themes/ktj.zsh-theme
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,22 @@ prompt_node() {
fi
}

prompt_db_environment() {
root_path=$(git rev-parse --show-toplevel 2>/dev/null)
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
if [[ -e "${root_path}/.env" ]]; then
database_url=$(grep -v '^#' "${root_path}/.env" | grep 'DATABASE_URL_NON_POOLING' | tail -n 1)
if [[ -n "$database_url" ]]; then
if [[ $database_url == *mana-copilot-app-data-staging* ]]; then
echo -ne "%{$fg[red]%}🐘 staging%{$fg[reset]%}"
elif [[ $database_url == *mana-copilot-app-data* ]]; then
echo -ne "%{$fg[red]%}🐘 prod%{$fg[reset]%}"
fi
fi
fi
fi
}

prompt_node_version() {
if which node &> /dev/null; then
echo -ne "%{$fg_bold[green]%}⬢ $(node -v | cut -d'.' -f1 | cut -c2-3)%{$reset_color%}"
Expand Down Expand Up @@ -317,9 +333,10 @@ build_prompt() {
prompt_time
prompt_node
# prompt_node_version
prompt_db_environment
prompt_git
prompt_status
prompt_seated_db
# prompt_seated_db
}

init
Expand Down

0 comments on commit 68eb4d3

Please sign in to comment.