Skip to content

Commit

Permalink
fix port
Browse files Browse the repository at this point in the history
  • Loading branch information
chofnar committed Jan 23, 2024
1 parent 6cce6f1 commit 054a3c0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/vm-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,6 @@ jobs:
-e SUPER_SECRET_TOKEN=${{ secrets.SUPER_SECRET_TOKEN }} \
-e LIMIT=${{ secrets.LIMIT }} \
-e RESET_WEBHOOK_URL=${{ secrets.RESET_WEBHOOK_URL }} \
-e WEBHOOK_PORT=${{ secrets.WEBHOOK_PORT }} \
-e PORT=${{ secrets.PORT }} \
chofnar/go-release-bot:${{ github.sha }}
5 changes: 3 additions & 2 deletions internal/server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
)

type BotConfig struct {
TelegramToken, WebhookSite, Port, GithubGQLToken, ResetWebhookUrl string
Limit int
TelegramToken, WebhookSite, WebhookPort, Port, GithubGQLToken, ResetWebhookUrl string
Limit int
}

func LoadBotConfig() *BotConfig {
Expand All @@ -24,6 +24,7 @@ func LoadBotConfig() *BotConfig {
TelegramToken: os.Getenv("TELEGRAM_BOT_TOKEN"),
WebhookSite: os.Getenv("TELEGRAM_BOT_SITE_URL"),
Port: os.Getenv("PORT"),
WebhookPort: os.Getenv("WEBHOOK_PORT"),
GithubGQLToken: os.Getenv("GRAPHQL_TOKEN"),
ResetWebhookUrl: os.Getenv("RESET_WEBHOOK_URL"),
Limit: limit,
Expand Down
6 changes: 5 additions & 1 deletion internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ func Start() {
}

if botConf.ResetWebhookUrl != "" {
url := botConf.WebhookSite + "/bot/" + botConf.TelegramToken
var webhookPort string
if botConf.WebhookPort != "" {
webhookPort = ":" + botConf.WebhookPort
}
url := botConf.WebhookSite + webhookPort + "/bot/" + botConf.TelegramToken
logger.Info("resetting webhook url to: " + botConf.WebhookSite + "/bot/TOKEN")
err = bot.SetWebhook(&telego.SetWebhookParams{
URL: url,
Expand Down

0 comments on commit 054a3c0

Please sign in to comment.