mirror of
https://github.com/openziti/zrok.git
synced 2025-08-09 08:05:04 +02:00
migrated all usages to the new package (#369)
This commit is contained in:
@ -14,7 +14,7 @@ import (
|
||||
zrok_config "github.com/openziti/zrok/controller/config"
|
||||
"github.com/openziti/zrok/controller/store"
|
||||
"github.com/openziti/zrok/controller/zrokEdgeSdk"
|
||||
"github.com/openziti/zrok/environment/env_v0_3"
|
||||
"github.com/openziti/zrok/environment"
|
||||
"github.com/openziti/zrok/model"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
@ -133,7 +133,11 @@ func assertZrokProxyConfigType(edge *rest_management_api_client.ZitiEdgeManageme
|
||||
}
|
||||
|
||||
func getIdentityId(identityName string) (string, error) {
|
||||
zif, err := env_v0_3.ZitiIdentityFile(identityName)
|
||||
env, err := environment.LoadRoot()
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "error opening environment root")
|
||||
}
|
||||
zif, err := env.ZitiIdentityFile(identityName)
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(err, "error opening identity '%v' from environment", identityName)
|
||||
}
|
||||
@ -177,6 +181,11 @@ func assertIdentity(zId string, edge *rest_management_api_client.ZitiEdgeManagem
|
||||
}
|
||||
|
||||
func bootstrapIdentity(name string, edge *rest_management_api_client.ZitiEdgeManagement) (string, error) {
|
||||
env, err := environment.LoadRoot()
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "error loading environment root")
|
||||
}
|
||||
|
||||
idc, err := zrokEdgeSdk.CreateIdentity(name, rest_model_edge.IdentityTypeDevice, nil, edge)
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(err, "error creating '%v' identity", name)
|
||||
@ -195,7 +204,7 @@ func bootstrapIdentity(name string, edge *rest_management_api_client.ZitiEdgeMan
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(err, "error encoding identity config '%v'", name)
|
||||
}
|
||||
if err := env_v0_3.SaveZitiIdentity(name, out.String()); err != nil {
|
||||
if err := env.SaveZitiIdentity(name, out.String()); err != nil {
|
||||
return "", errors.Wrapf(err, "error saving identity config '%v'", name)
|
||||
}
|
||||
return zId, nil
|
||||
|
Reference in New Issue
Block a user