mirror of
https://github.com/openziti/zrok.git
synced 2025-06-11 04:16:40 +02:00
store api endpoint in zrokdir (#47)
This commit is contained in:
parent
65209caa53
commit
f3f887e535
@ -46,7 +46,7 @@ func (cmd *createAccountCommand) run(_ *cobra.Command, _ []string) {
|
||||
fmt.Println("entered emails do not match... aborting!")
|
||||
}
|
||||
|
||||
zrok, err := newZrokClient()
|
||||
zrok, err := newZrokClient(apiEndpoint)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ func (cmd *disableCommand) run(_ *cobra.Command, args []string) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
zrok, err := newZrokClient()
|
||||
zrok, err := newZrokClient(env.ApiEndpoint)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ func (cmd *enableCommand) run(_ *cobra.Command, args []string) {
|
||||
cmd.description = fmt.Sprintf("%v@%v", user.Username, hostName)
|
||||
}
|
||||
|
||||
zrok, err := newZrokClient()
|
||||
zrok, err := newZrokClient(apiEndpoint)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -69,7 +69,7 @@ func (cmd *enableCommand) run(_ *cobra.Command, args []string) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err := zrokdir.SaveEnvironment(&zrokdir.Environment{ZrokToken: token, ZitiIdentityId: resp.Payload.Identity}); err != nil {
|
||||
if err := zrokdir.SaveEnvironment(&zrokdir.Environment{ZrokToken: token, ZitiIdentityId: resp.Payload.Identity, ApiEndpoint: apiEndpoint}); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err := zrokdir.WriteZitiIdentity("environment", resp.Payload.Cfg); err != nil {
|
||||
|
@ -69,7 +69,7 @@ func (self *httpBackendCommand) run(_ *cobra.Command, args []string) {
|
||||
EndpointAddress: args[0],
|
||||
}
|
||||
|
||||
zrok, err := newZrokClient()
|
||||
zrok, err := newZrokClient(env.ApiEndpoint)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -49,8 +49,8 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
func newZrokClient() (*rest_client_zrok.Zrok, error) {
|
||||
apiUrl, err := url.Parse(apiEndpoint)
|
||||
func newZrokClient(endpoint string) (*rest_client_zrok.Zrok, error) {
|
||||
apiUrl, err := url.Parse(endpoint)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "error parsing api endpoint '%v'", apiEndpoint)
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
type Environment struct {
|
||||
ZrokToken string `json:"zrok_token"`
|
||||
ZitiIdentityId string `json:"ziti_identity"`
|
||||
ApiEndpoint string `json:"api_endpoint"`
|
||||
}
|
||||
|
||||
func Delete() error {
|
||||
|
Loading…
x
Reference in New Issue
Block a user