Fix(Webhook): HostURL for generation
Some checks failed
Webhook-Everything/Webhook-Everything/pipeline/head There was a failure building this commit
Some checks failed
Webhook-Everything/Webhook-Everything/pipeline/head There was a failure building this commit
This commit is contained in:
@@ -12,13 +12,14 @@ import (
|
||||
type Env struct {
|
||||
DB *gorm.DB
|
||||
TelegramEnv *telegrampackage.Env
|
||||
HostUrl string
|
||||
HostURL string
|
||||
}
|
||||
|
||||
func WebhookEverythingRoutes(db *gorm.DB, telegramEnv *telegrampackage.Env, hostURL string) chi.Router {
|
||||
var env Env
|
||||
env.DB = db
|
||||
env.TelegramEnv = telegramEnv
|
||||
env.HostURL = hostURL
|
||||
|
||||
// Seed random
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
@@ -13,7 +13,7 @@ func (env *Env) registerWebhook(shortCode string, text string) (bool, *string) {
|
||||
commandSplitted := telegrampackage.ParseTelegramBotCommand(text)
|
||||
if len(commandSplitted) > 0 && commandSplitted[0] == "/register-webhook" {
|
||||
newWebhookID := genWebhookCode(6)
|
||||
baseURL, _ := url.Parse(env.HostUrl)
|
||||
baseURL, _ := url.Parse(env.HostURL)
|
||||
baseURL.Path = path.Join(baseURL.Path, "webhook")
|
||||
baseURL.Path = path.Join(baseURL.Path, "routes")
|
||||
baseURL.Path = path.Join(baseURL.Path, newWebhookID)
|
||||
|
||||
Reference in New Issue
Block a user