-
Notifications
You must be signed in to change notification settings - Fork 1
/
.dplsh.profile
51 lines (47 loc) · 1.86 KB
/
.dplsh.profile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
echo "** Danish Public Libraries Platform Shell **"
echo "... Fetching Storage Account key to unlock terraform state"
AZURE_KEYVAULT_NAME=kv-dpltfstatealpha001
AZURE_SUBSCRIPTION=8ac8a259-5bb3-4799-bd1e-455145b12550
export ARM_ACCESS_KEY=$(\
az keyvault secret show \
--subscription "${AZURE_SUBSCRIPTION}" \
--name tfstate-storage-key \
--vault-name ${AZURE_KEYVAULT_NAME} \
--query value \
-o tsv\
)
if [[ -z "${ARM_ACCESS_KEY}" ]]; then
echo "ERROR: Could not retrieve the tfstate-storage-key secret from keyvault."
echo "Verify your current az login session has enough permissions to do so."
echo "Keyvault name: ${AZURE_KEYVAULT_NAME}, subscription: ${AZURE_SUBSCRIPTION}"
exit 1
fi
export DNSIMPLE_TOKEN=$(\
az keyvault secret show \
--subscription "${AZURE_SUBSCRIPTION}" \
--name dnsimple-api-key \
--vault-name ${AZURE_KEYVAULT_NAME} \
--query value -o tsv\
)
if [[ -z "${DNSIMPLE_TOKEN}" ]]; then
echo "ERROR: Could not retrieve the dnsimple-api-key secret from keyvault."
echo "Verify your current az login session has enough permissions to do so."
echo
echo "Keyvault name: ${AZURE_KEYVAULT_NAME}, subscription: ${AZURE_SUBSCRIPTION}"
exit 1
fi
export DNSIMPLE_ACCOUNT="61014"
export DPLPLAT_ENV="dplplat01"
# Get bash completion and set the alias and set completion for the alias
source <(kubectl completion bash)
alias kc=kubectl
complete -o default -F __start_kubectl kc
# Give PS1 some color so it's eaiser to find
export PS1='\[$(printf "\x1b[38;2;255;100;250m\]$(hostname):$(pwd)$ \[\x1b[0m")\]'
echo
echo "Environment is assumed to be 'dplplat01'"
echo "If you want to operate another environment, run 'export DPLPLAT_ENV=<environment>'"
echo "Consult https://github.com/danskernesdigitalebibliotek/dpl-platform/blob/main/docs/platform-environments.md"
echo
echo "Now run "task" to continue your work."
echo