Skip to content

Instantly share code, notes, and snippets.

@irvingpop
Last active September 10, 2017 03:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save irvingpop/1bc6d4e1075fc2e7dac4df4d045f93b8 to your computer and use it in GitHub Desktop.
Save irvingpop/1bc6d4e1075fc2e7dac4df4d045f93b8 to your computer and use it in GitHub Desktop.
From 4fb2f312c60cd10f57c08051d4243d3e62b1fbfb Mon Sep 17 00:00:00 2001
From: Irving Popovetsky <irving@chef.io>
Date: Fri, 18 Aug 2017 13:05:55 -0700
Subject: [PATCH] Fix notifications habitat binds so that they can be optional
and remove an unneeded one for database
---
diff --git a/notifications/habitat/config/env b/notifications/habitat/config/env
index faa23c642..19d70da22 100644
--- a/notifications/habitat/config/env
+++ b/notifications/habitat/config/env
@@ -1,9 +1,20 @@
+{{#if bind.elasticsearch}}
+ export ELASTICSEARCH_URL={{bind.elasticsearch.first.sys.ip}}
+{{else}}
+ export ELASTICSEARCH_URL={{cfg.elasticsearch_host}}
+{{/if}}
+
+{{#if bind.rabbitmq}}
+ export RABBITMQ_HOST={{bind.rabbitmq.first.sys.ip}}
+{{else}}
+ export RABBITMQ_HOST={{cfg.rabbitmq_host}}
+{{/if}}
+
+
export HOME="{{pkg.svc_var_path}}"
-export RABBITMQ_HOST={{bind.rabbitmq.first.sys.ip}}
export RABBITMQ_VHOST={{cfg.rabbitmq.vhost}}
export RABBITMQ_USER={{cfg.rabbitmq.user}}
export RABBITMQ_PASSWORD={{cfg.rabbitmq.password}}
-export ELASTICSEARCH_URL={{bind.elasticsearch.first.sys.ip}}
export AUTOMATE_FQDN={{cfg.automate.fqdn}}
export PORT="{{cfg.port}}"
export REPLACE_OS_VARS="true"
diff --git a/notifications/habitat/plan.sh b/notifications/habitat/plan.sh
index a64ae9889..c339c2adb 100644
--- a/notifications/habitat/plan.sh
+++ b/notifications/habitat/plan.sh
@@ -11,8 +11,7 @@ pkg_deps=(
pkg_build_deps=(
core/make
)
-pkg_binds=(
- [database]="port"
+pkg_binds_optional=(
[elasticsearch]="http-port"
[rabbitmq]="port"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment