-
Notifications
You must be signed in to change notification settings - Fork 33
/
ion_darts
executable file
·79 lines (68 loc) · 1.8 KB
/
ion_darts
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/sh
#
# ion_darts
#
# Set the Consul and Vault environment variables to correct values for Vaultron
#
# NOTE: This file should be _sourced_, not executed.
# Example: `. ./ion_darts`
#
# shellcheck disable=SC1091
. ./skydome
TF_VAR_vault_flavor=$TF_VAR_vault_flavor
# ChromeOS Linux CrosVM environment
crosvm_env() {
if [ "$TF_VAR_vault_flavor" != "raft" ]; then
ETH0IP="$(/sbin/ifconfig eth0 | grep -w 'inet' | awk '{print $2}')"
CONSUL_CACERT="$(pwd)/red_lion/tls/ca.pem"
CONSUL_HTTP_ADDR="$ETH0IP:8500"
CONSUL_HTTP_SSL=true
CONSUL_HTTP_TOKEN="b4c0ffee-3b77-04af-36d6-738b697872e6"
fi
VAULT_ADDR="https://$ETH0IP:8200"
VAULT_CACERT="$(pwd)/black_lion/tls/ca.pem"
if [ "$TF_VAR_vault_flavor" != "raft" ]; then
export \
CONSUL_CACERT \
CONSUL_HTTP_ADDR \
CONSUL_HTTP_SSL \
CONSUL_HTTP_TOKEN;
fi
export VAULT_ADDR \
VAULT_CACERT
msg success "Exported Vaultron environment variables:"
if [ "$TF_VAR_vault_flavor" != "raft" ]; then
msg success "CONSUL_HTTP_ADDR: $CONSUL_HTTP_ADDR"
fi
msg success "VAULT_ADDR: $VAULT_ADDR"
}
# All others
default_env() {
if [ "$TF_VAR_vault_flavor" != "raft" ]; then
CONSUL_CACERT="$(pwd)/red_lion/tls/ca.pem"
CONSUL_HTTP_ADDR="127.0.0.1:8500"
CONSUL_HTTP_SSL=true
CONSUL_HTTP_TOKEN="b4c0ffee-3b77-04af-36d6-738b697872e6"
fi
VAULT_ADDR="https://127.0.0.1:8200"
VAULT_CACERT="$(pwd)/black_lion/tls/ca.pem"
if [ "$TF_VAR_vault_flavor" != "raft" ]; then
export \
CONSUL_CACERT \
CONSUL_HTTP_ADDR \
CONSUL_HTTP_SSL \
CONSUL_HTTP_TOKEN;
fi
export VAULT_ADDR \
VAULT_CACERT
msg success "Exported Vaultron environment variables:"
if [ "$TF_VAR_vault_flavor" != "raft" ]; then
msg success "CONSUL_HTTP_ADDR: $CONSUL_HTTP_ADDR"
fi
msg success "VAULT_ADDR: $VAULT_ADDR"
}
if [ -n "$SOMMELIER_VERSION" ]; then
crosvm_env
else
default_env
fi