From 66ff30de82e965d9e19b37ffaccb59f065572b73 Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Thu, 10 Feb 2022 07:43:19 +0100 Subject: [PATCH] declutter .bashrc append file --- .bashrc_append_this | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/.bashrc_append_this b/.bashrc_append_this index a0a82a7..52d73d1 100644 --- a/.bashrc_append_this +++ b/.bashrc_append_this @@ -1,7 +1,6 @@ ####################################### # APPEND this to your .bashrc ####################################### - # Source local .bashrc customization from this file if [ -f ~/.bashrc_local ]; then . ~/.bashrc_local @@ -11,3 +10,36 @@ fi if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi + +export PS1="\[$(tput bold)\]\[\033[48;5;139m\]\w\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;15m\]\\$ \[$(tput sgr0)\]" + +vaulthelper() { + if [ $(ifconfig | grep -A2 '^utun[0-9]:' | grep -c '[[:space:]]inet 172.31.251') -eq 1 ]; then + $(~/git/vault-helper -keychain -username $(id -un)); + launchctl setenv VAULT_TOKEN $VAULT_TOKEN + else + echo "You're not connected to Unic VPN, vaulthelper won't work" + fi +} + +if [ -z $(launchctl getenv VAULT_TOKEN) ] +then + vaulthelper +else + export VAULT_TOKEN=$(launchctl getenv VAULT_TOKEN) +fi + +# Fetch a Splunk auth token for ansible history +if [ ! -z $VAULT_TOKEN ]; then export SPLUNK_AUTHTOKEN=$(curl -X GET https://vault.unic.com/api/v1/secrets/14730/fields/api-key -H "Authorization: Bearer $VAULT_TOKEN" -s | tr -d \"); else echo "Splunk: \$VAULT_TOKEN not set"; fi + +export VIRTUALENV_PYTHON=/usr/local/bin/python3 +export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3 +export WORKON_HOME=~/python_envs/ +source /usr/local/bin/virtualenvwrapper.sh + +eval $(thefuck --alias) + +test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash" + +ulimit -n 1024 +. "$HOME/.cargo/env"