Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
akurilov committed Sep 17, 2023
1 parent 93807a2 commit 710d7af
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ go.work
vendor/
./bot-telegram
tg-bot-token.txt
*.pem
*.key
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
type Config struct {
Api struct {
Host string `envconfig:"API_HOST" default:"demo.awakari.cloud" required:"true"`
Path string `envconfig:"API_PATH" default:"/webhook" required:"true"`
Path string `envconfig:"API_PATH" default:"/" required:"true"`
Port uint16 `envconfig:"API_PORT" default:"8080" required:"true"`
Token string `envconfig:"API_TOKEN" required:"true"`
}
Expand Down
2 changes: 1 addition & 1 deletion helm/bot-telegram/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ spec:
volumes:
- name: server-cert
secret:
secretName: secret-api-tls-server
secretName: secret-bot-telegram-tls-server
items:
- key: tls.crt
path: tls.crt
Expand Down
2 changes: 1 addition & 1 deletion helm/bot-telegram/values-demo-0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ ingress:
- path: /
pathType: ImplementationSpecific
tls:
- secretName: secret-api-tls-server
- secretName: secret-bot-telegram-tls-server
hosts:
- demo.tgbot.awakari.cloud
4 changes: 1 addition & 3 deletions helm/bot-telegram/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ ingress:
paths:
- path: /
pathType: ImplementationSpecific
tlsCa:
secretName: secret-api-tls-ca
tls:
- secretName: secret-api-tls-server
- secretName: secret-bot-telegram-tls-server
hosts:
- bot-telegram.local

Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func main() {
if info.LastErrorDate != 0 {
panic(err)
}
log.Info(fmt.Sprintf("Webhook listen path: %s", cfg.Api.Path))
chUpdates := bot.ListenForWebhook(cfg.Api.Path)
//
http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
Expand All @@ -61,6 +62,7 @@ func main() {
//
go http.ListenAndServe(fmt.Sprintf("0.0.0.0:%d", cfg.Api.Port), nil)
//
log.Info("Start processing updates...")
for update := range chUpdates {
log.Info(fmt.Sprintf("%+v\n", update))
}
Expand Down

0 comments on commit 710d7af

Please sign in to comment.