-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
41 lines (32 loc) · 850 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
38
39
40
41
package main
import (
"log"
"os"
"github.com/Artur-Galstyan/workcraft-stronghold/database"
"github.com/Artur-Galstyan/workcraft-stronghold/events"
"github.com/Artur-Galstyan/workcraft-stronghold/stronghold"
"github.com/joho/godotenv"
_ "github.com/mattn/go-sqlite3"
)
var apiKey string
var (
Version = "dev"
BuildDate = "unknown"
CommitHash = "unknown"
)
func init() {
if err := godotenv.Load(); err != nil {
log.Fatal("Error loading .env file")
}
apiKey = os.Getenv("WORKCRAFT_API_KEY")
if apiKey == "" {
log.Fatal("WORKCRAFT_API_KEY not set in environment")
}
}
func main() {
log.Printf("Version: %s, Build Date: %s, Commit: %s\n", Version, BuildDate, CommitHash)
database.InitDB()
eventSender := events.NewEventSender()
stronhold := stronghold.NewStronghold(apiKey, database.DB, eventSender)
stronhold.Run()
}