-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
37 lines (32 loc) · 740 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"log"
"net/http"
"os"
"github.com/joho/godotenv"
"github.com/stanleynguyen/mindmaker/mindmaker"
"github.com/stanleynguyen/mindmaker/persistence/postgres"
)
func main() {
if os.Getenv("GO_ENV") != "production" {
err := godotenv.Load()
if err != nil {
log.Fatal(err)
}
}
// database, err := redis.NewInstance(os.Getenv("DB"))
database, err := postgres.NewInstance(os.Getenv("DB"))
if err != nil {
log.Fatal(err)
}
err = mindmaker.Initialize(mindmaker.Config{
Token: os.Getenv("BOT_TOKEN"),
SSL: false,
WebhookAddr: os.Getenv("WEBHOOK_URL"),
ListeningPath: "/",
}, database)
if err != nil {
log.Fatal(err)
}
http.ListenAndServe(":"+os.Getenv("PORT"), nil)
}