Use ttp shell function from tritonshell

This commit is contained in:
teutat3s 2022-02-02 03:07:28 +01:00
parent 7e3afff152
commit eca6d4d999
Signed by: teutat3s
GPG key ID: 4FA1D3FA524F22C1

View file

@ -54,18 +54,32 @@
alias wg-down="sudo systemctl stop wg-quick@wg0.service"
# Helper function for docker on triton
ttdo () {
ttp() {
if [[ "$1" == "set" ]]; then
if [[ -n "$2" ]]; then
source unset-env.sh
triton profile set "$2"
fi
source ~/CodeRoom/greenbaum.cloud/triton-docker.env.sh
source ~/CodeRoom/greenbaum.cloud/tritonshell/template/pkgs/utils/triton-docker.env.sh
elif [[ "$1" == "unset" ]]; then
eval "$(triton env --unset)" && unset TRITON_CNS_SEARCH_DOMAIN_PRIVATE TRITON_CNS_SEARCH_DOMAIN_PUBLIC
source ~/CodeRoom/greenbaum.cloud/tritonshell/template/pkgs/utils/unset-env.sh
elif [[ "$1" == "env" ]]; then
env | grep "DOCKER\|TRITON\|SDC"
env | grep "DOCKER\|MANTA\|SDC\|TRITON" | sort
else
/usr/bin/docker $@
echo "this is a helper function to quickly switch triton profiles"
echo "and setup the required environment variables"
echo "for triton, manta and the remote docker host (API)"
echo
echo 'use "ttp set your-profile" to switch to a profile'
echo
echo 'use "ttp unset" to clear all environment variables used by these CLIs'
echo "useful if you'd like to run a docker command against the"
echo "local docker host"
echo
echo 'use "ttp env" to view the currently set environment variables'
echo "used by the triton & manta CLIs"
echo
echo 'use "ttp help" to view this help'
fi
}