mirror of
https://github.com/openziti/zrok.git
synced 2025-06-23 19:22:19 +02:00
update backend proxy endpoint when overridden (#125)
This commit is contained in:
parent
135fd483fa
commit
7458c625aa
@ -98,6 +98,23 @@ func (cmd *shareReservedCommand) run(_ *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
logrus.Infof("sharing target endpoint: '%v'", cfg.EndpointAddress)
|
logrus.Infof("sharing target endpoint: '%v'", cfg.EndpointAddress)
|
||||||
|
|
||||||
|
if resp.Payload.BackendProxyEndpoint != targetEndpoint {
|
||||||
|
upReq := service.NewUpdateShareParams()
|
||||||
|
upReq.Body = &rest_model_zrok.UpdateShareRequest{
|
||||||
|
ServiceToken: svcToken,
|
||||||
|
BackendProxyEndpoint: targetEndpoint,
|
||||||
|
}
|
||||||
|
if _, err := zrok.Service.UpdateShare(upReq, auth); err != nil {
|
||||||
|
if !panicInstead {
|
||||||
|
showError("unable to update backend proxy endpoint", err)
|
||||||
|
}
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
logrus.Infof("updated backend proxy endpoint to: %v", targetEndpoint)
|
||||||
|
} else {
|
||||||
|
logrus.Infof("using existing backend proxy endpoint: %v", targetEndpoint)
|
||||||
|
}
|
||||||
|
|
||||||
httpProxy, err := backend.NewHTTP(cfg)
|
httpProxy, err := backend.NewHTTP(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ui.Close()
|
ui.Close()
|
||||||
|
@ -15,6 +15,8 @@ func newShareHandler() *shareHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h *shareHandler) Handle(params service.ShareParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
func (h *shareHandler) Handle(params service.ShareParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||||
|
logrus.Infof("handling")
|
||||||
|
|
||||||
tx, err := str.Begin()
|
tx, err := str.Begin()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorf("error starting transaction: %v", err)
|
logrus.Errorf("error starting transaction: %v", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user