adding redirect url to enviroment

This commit is contained in:
Pavel 2024-06-02 14:17:48 +03:00
parent e5e60e2ee2
commit 93a77ed399
4 changed files with 18 additions and 13 deletions

@ -94,9 +94,10 @@ func Run(ctx context.Context, config initialize.Config, logger *zap.Logger) erro
})
cntrlDeps := controllers.Deps{
Service: svc,
Logger: logger,
Verify: tools.NewVerify(config.IntegrationSecret, config.IntegrationID),
Service: svc,
Logger: logger,
Verify: tools.NewVerify(config.IntegrationSecret, config.IntegrationID),
RedirectURL: config.RedirectURL,
}
controller := controllers.NewController(cntrlDeps)

@ -8,9 +8,10 @@ import (
)
type Deps struct {
Service *service.Service
Logger *zap.Logger
Verify *tools.Verify
Service *service.Service
Logger *zap.Logger
Verify *tools.Verify
RedirectURL string
}
type Controller struct {
@ -54,16 +55,18 @@ func (c *Controller) Name() string {
}
type WebhookController struct {
service *service.Service
logger *zap.Logger
verify *tools.Verify
service *service.Service
logger *zap.Logger
verify *tools.Verify
redirectURL string
}
func NewWebhookController(deps Deps) *WebhookController {
return &WebhookController{
service: deps.Service,
logger: deps.Logger,
verify: deps.Verify,
service: deps.Service,
logger: deps.Logger,
verify: deps.Verify,
redirectURL: deps.RedirectURL,
}
}

@ -48,7 +48,7 @@ func (c *WebhookController) WebhookCreate(ctx *fiber.Ctx) error {
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
}
return ctx.Redirect("https://squiz.pena.digital/integrations")
return ctx.Redirect(c.redirectURL)
}
// todo проверить надо

@ -27,6 +27,7 @@ type Config struct {
// секрет интеграции
IntegrationSecret string `env:"INTEGRATION_SECRET" envDefault:"tNK3LwL4ovP0OBK4jKDHJ3646PqRJDOKQYgY6P2t6DCuV8LEzDzszTDY0Fhwmzc8"`
AmoStorageURL string `env:"AMO_STORAGE_URL" envDefault:"https://drive-b.amocrm.ru"`
RedirectURL string `env:"REDIRECT_URL" envDefault:"https://squiz.pena.digital/integrations"`
}
func LoadConfig() (*Config, error) {