-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path.env
More file actions
29 lines (21 loc) · 688 Bytes
/
Copy path.env
File metadata and controls
29 lines (21 loc) · 688 Bytes
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
#!/bin/bash
# directory path
target_dir="$(pwd -P)"
# kubeconfig path
kubeconfig_file="${target_dir}/kubeconfig"
# directory name
config_dir="${target_dir##*/}"
if [[ -r "$kubeconfig_file" ]] && [[ -f "$kubeconfig_file" ]]; then
# this is .env directory
dir="$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" >/dev/null 2>&1 && pwd )"
# shellcheck source=/dev/null
source "$dir/.function"
result=$(setup_config_directory "$target_dir" 2>&1)
echo "$result"
if [[ "${result}" =~ ^ERROR:.*$ ]]; then
echo "Can not load config. Ignore it."
else
export KUBECONFIG="$kubeconfig_file"
echo "Set config to $config_dir"
fi
fi