Clever/discovery-go

Name: discovery-go

Owner: Clever

Description: Programmatically find services

Created: 2015-08-03 21:51:29.0

Updated: 2018-05-24 02:38:20.0

Pushed: 2018-05-24 02:38:19.0

Homepage: null

Size: 33

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

discovery-go

This library programmatically finds endpoints for dependencies. Similar to discovery-node and disocvery-python.

See Service Discovery for more details.

API

Godoc Documentation

Examples
manAdminURLString, err := discovery.URL("gearman-admin", "http")
rr != nil {
log.Fatal("ERROR: " + err.Error())


edHostPort, err := discovery.HostPort("stoked", "thrift")
rr != nil {
logger.Fatal("ERROR: " + err.Error())


edHost, err := discovery.Host("stoked", "thrift")
rr != nil {
logger.Fatal("ERROR: " + err.Error())


edPort, err := discovery.Port("stoked", "thrift")
rr != nil {
logger.Fatal("ERROR: " + err.Error())

Implementation Details

Currently, discovery-{go,node,python} looks for environment variables with the following format:

ICE_{SERVICE_NAME}_{EXPOSE_NAME}_{PROTO,HOST,PORT}

These environment variables are autogenerated by fab and catapult during app deployment. Three env-vars are created for each app listed in the dependencies section of caller's launch yaml.

For example, if an app lists district-authorizations as a dependency, fab and catapult will generate this env-vars triplet:

ICE_DISTRICT_AUTHORIZATIONS_HTTP_PROTO = "http"
ICE_DISTRICT_AUTHORIZATIONS_HTTP_HOST = "district-authorizations.ops.clever.com"
ICE_DISTRICT_AUTHORIZATIONS_HTTP_PORT = "80"

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.