-
Notifications
You must be signed in to change notification settings - Fork 35
/
.envrc
38 lines (37 loc) · 1.51 KB
/
.envrc
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
export HAB_DOCKER_OPTS="-p 80:80 -p 9636:9636 -p 9631:9631 -p 9638:9638 -p 5432:5432"
export HAB_STUDIO_SUP="--auto-update"
export HAB_ORIGIN_KEYS
export HAB_ORIGIN="habitat"
if [ -d ~/.hab ]; then
HAB_CONFIG=~/.hab/etc/cli.toml
if [ -e "$HAB_CONFIG" ]; then
export HAB_AUTH_TOKEN=$(cat $HAB_CONFIG | grep "auth_token" | awk '{print $3}' | tr -d '"')
export HAB_ORIGIN=$(cat $HAB_CONFIG | grep "origin" | awk '{print $3}' | tr -d '"')
fi
if ls ~/.hab/cache/keys/*.sig.key 1> /dev/null 2>&1; then
HAB_ORIGIN_KEY_NAMES=$(find ~/.hab/cache/keys/*.sig.key -type f -exec basename {} \;)
for key in $HAB_ORIGIN_KEY_NAMES; do
HAB_ORIGIN_KEYS="$HAB_ORIGIN_KEYS ${key%-*}"
done
HAB_ORIGIN_KEYS=$(echo $HAB_ORIGIN_KEYS | tr ' ', ',')
fi
else
HAB_CONFIG=/hab/etc/cli.toml
if [ -e "$HAB_CONFIG" ]; then
export HAB_AUTH_TOKEN=$(cat $HAB_CONFIG | grep "auth_token" | awk '{print $3}' | tr -d '"')
export HAB_ORIGIN=$(cat $HAB_CONFIG | grep "origin" | awk '{print $3}' | tr -d '"')
fi
if ls /hab/cache/keys/*.sig.key 1> /dev/null 2>&1; then
HAB_ORIGIN_KEY_NAMES=$(find /hab/cache/keys/*.sig.key -type f -exec basename {} \;)
for key in $HAB_ORIGIN_KEY_NAMES; do
HAB_ORIGIN_KEYS="$HAB_ORIGIN_KEYS ${key%-*}"
done
HAB_ORIGIN_KEYS=$(echo $HAB_ORIGIN_KEYS | tr ' ', ',')
fi
fi
if [ -n $HAB_ORIGIN ]; then
HAB_ORIGIN_KEYS="${HAB_ORIGIN_KEYS},${HAB_ORIGIN}"
fi
if [ -z "${HAB_AUTH_TOKEN:-}" ]; then
echo "WARNING: No auth token set. Please run hab setup before running builder."
fi