Skip to content

Commit 68b6a6e

Browse files
authored
Merge pull request #43 from CodeNow/bear-clone
Bear clone
2 parents 4177bc2 + fb8b020 commit 68b6a6e

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
consul = "{{ env "CONSUL_HOSTNAME" }}:{{ env "CONSUL_PORT" }}"
22

33
vault {
4-
address = "http://{{ env "CONSUL_HOSTNAME" }}:8200"
4+
address = "http://{{ env "VAULT_HOSTNAME" }}:{{ env "VAULT_PORT" }}"
55
token = "{{ env "VAULT_TOKEN" }}"
66
renew = false
77
}

init.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
export DOCK_INIT_BASE=/opt/runnable/dock-init
88
export HOST_IP=$(hostname -i)
9+
source "${DOCK_INIT_BASE}/lib/util/log.sh"
910

1011
if [ -z "${CONSUL_PORT+x}" ]; then
1112
export CONSUL_PORT=8500
@@ -14,19 +15,31 @@ else
1415
fi
1516

1617
if [ -z "${CONSUL_HOSTNAME+x}" ]; then
17-
export CONSUL_HOSTNAME=10.4.5.144
18+
log::fatal "CONSUL_HOSTNAME is not defined"
19+
exit 1
1820
else
1921
export CONSUL_HOSTNAME
2022
fi
2123

24+
if [ -z "${VAULT_PORT+x}" ]; then
25+
export VAULT_PORT=8200
26+
else
27+
export VAULT_PORT
28+
fi
29+
30+
if [ -z "${VAULT_HOSTNAME+x}" ]; then
31+
export VAULT_HOSTNAME=$CONSUL_HOSTNAME
32+
else
33+
export VAULT_HOSTNAME
34+
fi
35+
2236
export DOCKER_NETWORK=172.17.0.0/16
2337

2438
source "${DOCK_INIT_BASE}/lib/consul.sh"
2539
source "${DOCK_INIT_BASE}/lib/aws.sh"
2640
source "${DOCK_INIT_BASE}/lib/dock.sh"
2741
source "${DOCK_INIT_BASE}/lib/container.sh"
2842
source "${DOCK_INIT_BASE}/lib/iptables.sh"
29-
source "${DOCK_INIT_BASE}/lib/util/log.sh"
3043

3144
# Initializes the dock
3245
main() {

lib/vault.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ vault::create_s3_policy() {
1616
"Dock-Init: Cannot create policy template for ${bucket}" \
1717
"Attempting to create s3 policy template. ${OUTPUT}"
1818

19-
export VAULT_ADDR="http://${CONSUL_HOSTNAME}:8200"
19+
export VAULT_ADDR="http://${VAULT_HOSTNAME}:${VAULT_PORT}"
2020
log::info "Attempting to create s3 policy template for bucket ${bucket}"
2121

2222
local policy_template="${DOCK_INIT_BASE}/vault-resources/s3.policy"
@@ -35,7 +35,7 @@ vault::set_s3_keys() {
3535
"Dock-Init: Cannot create policy template" \
3636
"Attempting to create s3 policy template. ${OUTPUT}"
3737

38-
export VAULT_ADDR="http://${CONSUL_HOSTNAME}:8200"
38+
export VAULT_ADDR="http://${VAULT_HOSTNAME}:${VAULT_PORT}"
3939
log::info "Attempting get s3 creds"
4040
# Key Value
4141
# lease_id aws/creds/deploy/7cb8df71-782f-3de1-79dd-251778e49f58

0 commit comments

Comments
 (0)