// NewConsulConfigManager returns a new ConfigManager backed by consul. // Data will be encrypted. func NewConsulConfigManager(machines []string, keystore io.Reader) (ConfigManager, error) { store, err := consul.New(machines) if err != nil { return nil, err } return NewConfigManager(store, keystore) }
// NewStandardConsulConfigManager returns a new ConfigManager backed by consul. func NewStandardConsulConfigManager(machines []string) (ConfigManager, error) { store, err := consul.New(machines) if err != nil { return nil, err } return NewStandardConfigManager(store) }
// NewConsulConfigManager returns a new ConfigManager backed by consul. func NewConsulConfigManager(machines []string, keystore io.Reader) (ConfigManager, error) { store, err := consul.New(machines) if err != nil { return nil, err } bytes, err := ioutil.ReadAll(keystore) if err != nil { return nil, err } return configManager{bytes, store}, nil }
func getBackendStore(provider string, endpoint string) (backend.Store, error) { if endpoint == "" { switch provider { case "consul": endpoint = "127.0.0.1:8500" case "etcd": endpoint = "http://127.0.0.1:4001" } } machines := []string{endpoint} switch provider { case "etcd": return etcd.New(machines) case "consul": return consul.New(machines) default: return nil, errors.New("invalid backend " + provider) } }