go-telegram-bot-api / telegram-bot-api

Golang bindings for the Telegram Bot API

Home Page:https://go-telegram-bot-api.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to deploy on a paas platform with webhook

viogami opened this issue · comments

i am a start gopher.
What do I do with my cert files when i deploy a example main.go on a paas platform?
should i set two files : cert.pem and key.pem in the root?
😟I can get a free SSL files but i dont know how to use

The PaaS platform integrates the certificate service, do I have to use the cert file?

I have solved this problem.
The paas platform almost provide the SSL service,so don`t worry about the cert file questions.
Just modify the offical example as following:

...
  log.Printf("Authorized on account %s", bot.Self.UserName)
  wh, _ := tgbotapi.NewWebhook(TG_WEBHOOK_URL + bot.Token)

  ...

  go http.ListenAndServe(":"+port, nil)

Replace with you own TG_WEBHOOK_URL and port.

By the way , you must set PORT in the environment variable,and use os.Getenv("PORT") to invoke it .Beacause most PaaS platform deployment projects need to specify a port and cannot be called directly

If you know Chinese, you can see the implementation method of my repository