|
| 1 | +From df615a425a7f39f4535cea68370b8b3c819b279c Mon Sep 17 00:00:00 2001 |
| 2 | +From: thejsj <jorge.silva@thejsj.com> |
| 3 | +Date: Mon, 30 Jan 2017 17:44:25 -0800 |
| 4 | +Subject: [PATCH] Fix ENV |
| 5 | + |
| 6 | +--- |
| 7 | + 0001-Add-VAULT_HOSTNAME-and-VAULT_PORT.patch | 72 ++++++++++++++++++++++ |
| 8 | + .../templates/template-config.hcl.ctmpl | 2 +- |
| 9 | + 2 files changed, 73 insertions(+), 1 deletion(-) |
| 10 | + create mode 100644 0001-Add-VAULT_HOSTNAME-and-VAULT_PORT.patch |
| 11 | + |
| 12 | +diff --git a/0001-Add-VAULT_HOSTNAME-and-VAULT_PORT.patch b/0001-Add-VAULT_HOSTNAME-and-VAULT_PORT.patch |
| 13 | +new file mode 100644 |
| 14 | +index 0000000..6f08a1b |
| 15 | +--- /dev/null |
| 16 | ++++ b/0001-Add-VAULT_HOSTNAME-and-VAULT_PORT.patch |
| 17 | +@@ -0,0 +1,72 @@ |
| 18 | ++From ddd55bc77ca0195ba9e0576df6df39702abe5614 Mon Sep 17 00:00:00 2001 |
| 19 | ++From: thejsj <jorge.silva@thejsj.com> |
| 20 | ++Date: Mon, 30 Jan 2017 16:42:17 -0800 |
| 21 | ++Subject: [PATCH] Add VAULT_HOSTNAME and VAULT_PORT |
| 22 | ++ |
| 23 | ++--- |
| 24 | ++ consul-resources/templates/template-config.hcl.ctmpl | 2 +- |
| 25 | ++ init.sh | 12 ++++++++++++ |
| 26 | ++ lib/vault.sh | 4 ++-- |
| 27 | ++ 3 files changed, 15 insertions(+), 3 deletions(-) |
| 28 | ++ |
| 29 | ++diff --git a/consul-resources/templates/template-config.hcl.ctmpl b/consul-resources/templates/template-config.hcl.ctmpl |
| 30 | ++index c9560f5..3c38f6f 100644 |
| 31 | ++--- a/consul-resources/templates/template-config.hcl.ctmpl |
| 32 | +++++ b/consul-resources/templates/template-config.hcl.ctmpl |
| 33 | ++@@ -1,7 +1,7 @@ |
| 34 | ++ consul = "{{ env "CONSUL_HOSTNAME" }}:{{ env "CONSUL_PORT" }}" |
| 35 | ++ |
| 36 | ++ vault { |
| 37 | ++- address = "http://{{ env "CONSUL_HOSTNAME" }}:8200" |
| 38 | +++ address = "http://{{ env "VAULT_HOSTNAME" }}:{{ VAULT_PORT }}" |
| 39 | ++ token = "{{ env "VAULT_TOKEN" }}" |
| 40 | ++ renew = false |
| 41 | ++ } |
| 42 | ++diff --git a/init.sh b/init.sh |
| 43 | ++index 6f19416..442fad5 100644 |
| 44 | ++--- a/init.sh |
| 45 | +++++ b/init.sh |
| 46 | ++@@ -19,6 +19,18 @@ else |
| 47 | ++ export CONSUL_HOSTNAME |
| 48 | ++ fi |
| 49 | ++ |
| 50 | +++if [ -z "${VAULT_PORT+x}" ]; then |
| 51 | +++ export VAULT_PORT=8200 |
| 52 | +++else |
| 53 | +++ export VAULT_PORT |
| 54 | +++fi |
| 55 | +++ |
| 56 | +++if [ -z "${VAULT_HOSTNAME+x}" ]; then |
| 57 | +++ export VAULT_HOSTNAME=CONSUL_HOSTNAME |
| 58 | +++else |
| 59 | +++ export VAULT_HOSTNAME |
| 60 | +++fi |
| 61 | +++ |
| 62 | ++ export DOCKER_NETWORK=172.17.0.0/16 |
| 63 | ++ |
| 64 | ++ source "${DOCK_INIT_BASE}/lib/consul.sh" |
| 65 | ++diff --git a/lib/vault.sh b/lib/vault.sh |
| 66 | ++index dbe23c3..74aff74 100644 |
| 67 | ++--- a/lib/vault.sh |
| 68 | +++++ b/lib/vault.sh |
| 69 | ++@@ -16,7 +16,7 @@ vault::create_s3_policy() { |
| 70 | ++ "Dock-Init: Cannot create policy template for ${bucket}" \ |
| 71 | ++ "Attempting to create s3 policy template. ${OUTPUT}" |
| 72 | ++ |
| 73 | ++- export VAULT_ADDR="http://${CONSUL_HOSTNAME}:8200" |
| 74 | +++ export VAULT_ADDR="http://${VAULT_HOSTNAME}:${VAULT_PORT}" |
| 75 | ++ log::info "Attempting to create s3 policy template for bucket ${bucket}" |
| 76 | ++ |
| 77 | ++ local policy_template="${DOCK_INIT_BASE}/vault-resources/s3.policy" |
| 78 | ++@@ -35,7 +35,7 @@ vault::set_s3_keys() { |
| 79 | ++ "Dock-Init: Cannot create policy template" \ |
| 80 | ++ "Attempting to create s3 policy template. ${OUTPUT}" |
| 81 | ++ |
| 82 | ++- export VAULT_ADDR="http://${CONSUL_HOSTNAME}:8200" |
| 83 | +++ export VAULT_ADDR="http://${VAULT_HOSTNAME}:${VAULT_PORT}" |
| 84 | ++ log::info "Attempting get s3 creds" |
| 85 | ++ # Key Value |
| 86 | ++ # lease_id aws/creds/deploy/7cb8df71-782f-3de1-79dd-251778e49f58 |
| 87 | ++-- |
| 88 | ++2.9.0 |
| 89 | ++ |
| 90 | +diff --git a/consul-resources/templates/template-config.hcl.ctmpl b/consul-resources/templates/template-config.hcl.ctmpl |
| 91 | +index 3c38f6f..a6c5818 100644 |
| 92 | +--- a/consul-resources/templates/template-config.hcl.ctmpl |
| 93 | ++++ b/consul-resources/templates/template-config.hcl.ctmpl |
| 94 | +@@ -1,7 +1,7 @@ |
| 95 | + consul = "{{ env "CONSUL_HOSTNAME" }}:{{ env "CONSUL_PORT" }}" |
| 96 | + |
| 97 | + vault { |
| 98 | +- address = "http://{{ env "VAULT_HOSTNAME" }}:{{ VAULT_PORT }}" |
| 99 | ++ address = "http://{{ env "VAULT_HOSTNAME" }}:{{ env "VAULT_PORT" }}" |
| 100 | + token = "{{ env "VAULT_TOKEN" }}" |
| 101 | + renew = false |
| 102 | + } |
| 103 | +-- |
| 104 | +2.9.0 |
| 105 | + |
0 commit comments