1.0.21 • Published 7 years ago

service-discovery-settings v1.0.21

Weekly downloads
3
License
ISC
Repository
github
Last release
7 years ago

service-discovery-settings

Basic remote service discovery and configuration interface into Configuraiton Service

Configure the following in /resources/config.properties (this is the bare minimum of configuration, necessary to bootstrap):

service.discovery.url
service.id
service.scope

service.discovery.url specifies the url of the discovery server, service.id identifies the microservice, this is a unique name. service.scope identifies the scope of configuration, like local, development, qa, or production.

Three mechanisms of configuraiton are utilized in this module. Most basic is the local configuration coming from /resources/config.properties. These are local settings. A copy of this file ships with each docker container, and you need to map a volume to override the file. Second vehicle is the environment variables. This comes handy when running a container without mapping a volume. Finally, there's remote configuration, that is returned from the service discovery API. Behind the scenes, service discovery API runs on etcd, and configuration settings can be provided at the global microservice level, and overwritten for a specific scope.

Remote configuration is being re-read every 5 seconds, and the service keeps registering itself against the registry at the same time. Once service instance dies, it will no longer be visible in the registry.

For more information on the remote configuration, see the service discovery api.

For example,

service.discovery.url=http://127.0.0.1:8081
service.id=catalog
service.scope=development

Usage:

var config = require('service-discovery-settings');
var elasticLogLevel = config.get('elastic.log.level') || 'error';

You can listen in on configuration value changes:

config.listen('elastic.log.level', function(val){
    console.log(val);
});
1.0.21

7 years ago

1.0.20

7 years ago

1.0.19

7 years ago

1.0.17

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago