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
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This library programmatically finds endpoints for dependencies. Similar to discovery-node and disocvery-python.
See Service Discovery for more details.
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())
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"