-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.envrc-clusters.sh
48 lines (42 loc) · 1.19 KB
/
.envrc-clusters.sh
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
#!/usr/bin/env bash
if [ -z "${local_SNAPSHOT}" ]; then
# shellcheck disable=SC2148 source=/.envrc-k8s.sh
source_url "https://raw.githubusercontent.com/sourcesense/envrc-framework/v0.19.1/.envrc-k8s.sh" "sha256-dyJpu5wZnthqfY1CtPlQfDZgXsFyLvUfRKhco2abVEc="
else
# shellcheck disable=SC1091 source="${local_SNAPSHOT}"/.envrc-k8s.sh
source "${local_SNAPSHOT}"/.envrc-k8s.sh
fi
use_cp()
{
local cloud_provider="$1"
log "Setting env for cloud provider: $(ab "$cloud_provider")"
dep include sourcesense/k8s-common kube-config-"$cloud_provider"
}
enable_scripts()
{
BASE_CLUSTER="$(pwd)"
export BASE_CLUSTER
export BASE="${BASE:=$(dirname "$(find_up .envrc-k8s.sh)")}"
export SCRIPT_BASE="${SCRIPT_BASE:=$BASE/scripts}"
PATH_add "$SCRIPT_BASE"
}
pre_work_on_cluster()
{
# Nothing to to (depends on cloud provider)
return 0
}
work_on_cluster()
{
enable_scripts
pre_work_on_cluster
log "Working on cluster: $(ab "$CLUSTER_NAME")"
}
cache_dir_of()
{
local subject="$1"
local cache_dir="${XDG_CACHE_HOME:-$HOME/.cache}/envrc-framework/${subject}"
if [ ! -d "${cache_dir}" ]; then
mkdir -p "${cache_dir}"
fi
echo "${cache_dir}"
}