func createDataClients(o Options, auth innkeeper.Authentication) ([]routing.DataClient, error) { var clients []routing.DataClient if o.RoutesFile != "" { f, err := eskipfile.Open(o.RoutesFile) if err != nil { return nil, err } clients = append(clients, f) } if o.InnkeeperUrl != "" { ic, err := innkeeper.New(innkeeper.Options{ o.InnkeeperUrl, o.ProxyOptions.Insecure(), auth, o.InnkeeperPreRouteFilters, o.InnkeeperPostRouteFilters}) if err != nil { return nil, err } clients = append(clients, ic) } if len(o.EtcdUrls) > 0 { clients = append(clients, etcd.New(o.EtcdUrls, o.EtcdPrefix)) } return clients, nil }
func createInnkeeperClient(m *medium) (*innkeeperclient.Client, error) { auth := innkeeperclient.CreateInnkeeperAuthentication(innkeeperclient.AuthOptions{InnkeeperAuthToken: m.oauthToken}) ic, err := innkeeperclient.New(innkeeperclient.Options{ Address: m.urls[0].String(), Insecure: insecure, Authentication: auth}) if err != nil { return nil, err } return ic, nil }
func createDataClients(o Options, auth innkeeper.Authentication) ([]routing.DataClient, error) { var clients []routing.DataClient if o.RoutesFile != "" { f, err := eskipfile.Open(o.RoutesFile) if err != nil { log.Error(err) return nil, err } clients = append(clients, f) } if o.InnkeeperUrl != "" { ic, err := innkeeper.New(innkeeper.Options{ o.InnkeeperUrl, o.InnkeeperInsecure, auth, o.InnkeeperPreRouteFilters, o.InnkeeperPostRouteFilters}) if err != nil { log.Error(err) return nil, err } clients = append(clients, ic) } if len(o.EtcdUrls) > 0 { etcdClient, err := etcd.New(etcd.Options{ o.EtcdUrls, o.EtcdPrefix, o.EtcdWaitTimeout, o.EtcdInsecure}) if err != nil { return nil, err } clients = append(clients, etcdClient) } if o.KubernetesURL != "" { clients = append(clients, kubernetes.New(kubernetes.Options{ KubernetesURL: o.KubernetesURL, ProvideHealthcheck: o.KubernetesHealthcheck, })) } return clients, nil }