Allow to set daemon and server configurations in a file.

Read configuration after flags making this the priority:

1- Apply configuration from file.
2- Apply configuration from flags.

Reload configuration when a signal is received, USR2 in Linux:

- Reload router if the debug configuration changes.
- Reload daemon labels.
- Reload cluster discovery.

Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
David Calavera 2015-12-10 18:35:10 -05:00
parent 409a9da270
commit 3ac1016064
2 changed files with 3 additions and 6 deletions

View file

@ -12,12 +12,8 @@ import (
var ( var (
// Backends is a global map of discovery backends indexed by their // Backends is a global map of discovery backends indexed by their
// associated scheme. // associated scheme.
backends map[string]Backend
)
func init() {
backends = make(map[string]Backend) backends = make(map[string]Backend)
} )
// Register makes a discovery backend available by the provided scheme. // Register makes a discovery backend available by the provided scheme.
// If Register is called twice with the same scheme an error is returned. // If Register is called twice with the same scheme an error is returned.
@ -42,7 +38,7 @@ func parse(rawurl string) (string, string) {
// ParseAdvertise parses the --cluster-advertise daemon config which accepts // ParseAdvertise parses the --cluster-advertise daemon config which accepts
// <ip-address>:<port> or <interface-name>:<port> // <ip-address>:<port> or <interface-name>:<port>
func ParseAdvertise(store, advertise string) (string, error) { func ParseAdvertise(advertise string) (string, error) {
var ( var (
iface *net.Interface iface *net.Interface
addrs []net.Addr addrs []net.Addr

View file

@ -25,6 +25,7 @@ func Init() {
// Initialize sets the heartbeat for the memory backend. // Initialize sets the heartbeat for the memory backend.
func (s *Discovery) Initialize(_ string, heartbeat time.Duration, _ time.Duration, _ map[string]string) error { func (s *Discovery) Initialize(_ string, heartbeat time.Duration, _ time.Duration, _ map[string]string) error {
s.heartbeat = heartbeat s.heartbeat = heartbeat
s.values = make([]string, 0)
return nil return nil
} }