configurable edge client (#31)

This commit is contained in:
Michael Quigley
2022-08-12 11:03:15 -04:00
parent 1ef84865f0
commit 1f36af7cf5
7 changed files with 60 additions and 32 deletions

View File

@ -29,9 +29,8 @@ func ZrokAuthenticate(token string) (*rest_model_zrok.Principal, error) {
}
}
func edgeClient() (*rest_management_api_client.ZitiEdgeManagement, error) {
ctrlAddress := "https://linux:1280"
caCerts, err := rest_util.GetControllerWellKnownCas(ctrlAddress)
func edgeClient(cfg *ZitiConfig) (*rest_management_api_client.ZitiEdgeManagement, error) {
caCerts, err := rest_util.GetControllerWellKnownCas(cfg.ApiEndpoint)
if err != nil {
return nil, err
}
@ -39,7 +38,7 @@ func edgeClient() (*rest_management_api_client.ZitiEdgeManagement, error) {
for _, ca := range caCerts {
caPool.AddCert(ca)
}
return rest_util.NewEdgeManagementClientWithUpdb("admin", "admin", ctrlAddress, caPool)
return rest_util.NewEdgeManagementClientWithUpdb(cfg.Username, cfg.Password, cfg.ApiEndpoint, caPool)
}
func generateApiToken() (string, error) {