Skip to content

Conversation

@BerryDaniel
Copy link

@BerryDaniel BerryDaniel commented May 24, 2017

Status

IN DEVELOPMENT

JIRA Ticket

CAPI-241

Description

  • deploys efc and efc-web
  • includes notes and json to create db
  • manifest now includes step to create the service and binding to the efc app
  • created a Map for keys and values found if VCAP_SERVICESS mqtt exists
  • Added connection options to pass to the connect function to include username and password to the connection.
  • Parses SSL from VCAP if enabled

Todos

Note: We still have an open ticket to make the mqtt public, currently it is a private ip.

Steps to Test or Reproduce

Outline the steps to test or reproduce the PR here.

see manifest.yml

- deploys efc and efc-web
- includes notes and json to create db
@BerryDaniel BerryDaniel requested a review from mrcnc May 24, 2017 17:24
Daniel Berry added 2 commits May 25, 2017 09:10
Note: We still have an open ticket to make the mqtt public, currently it is a private ip.

Additions:
-  manifest now includes step to create the service and binding to the efc app
- created a Map for keys and values found if VCAP_SERVCIES mqtt exists
- Added connection options to pass to the connect function to include username and password to the connection.
If using VCAP services connection, it will parse the ssl value and set the connection to ssl. For other applications the MQTT_BROKER_URL env variable will be used.
@BerryDaniel
Copy link
Author

@mrcnc scheme is now pulled from the vcap.

"Map of keys and values from VCAP_SERVICES mqtt environment variable"
(or (some-> (System/getenv "VCAP_SERVICES")
(json/read-str :key-fn clojure.core/keyword) :p-rabbitmq first :credentials :protocols :mqtt)
{:username :username
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if there isn't a VCAP_SERVICES environment variable, we'll want to set default mqtt options. Therefore the values in this map should represent that, ex

{:host "localhost" :port 1883 :ssl false}

(try
(do
(reset! conn (mh/connect url client-id))
(reset! conn (mh/connect url client-id mqtt-connect-ops))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we should allow connections to brokers that don't require any credentials. So refactor this to set credentials if they exist, otherwise connect with (mh/connect url client-id)

{:username (or (System/getenv "MQTT_USERNAME") (:username vcap_mqtt))
:password (or (System/getenv "MQTT_PASSWORD") (:password vcap_mqtt))})

(def vcap_tcp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename this to mqtt-url?


(def vcap_tcp
"When vcap_mqtt exists it returns a formated tcp connection"
(when (some? vcap_mqtt)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like are trying to define the url to use so this should always return a string....so I would remove this line b/c vcap_mqtt should always return the defaults that you can use to build the mqtt url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants