-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
44 lines (34 loc) · 874 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
42
43
44
package main
import (
"backendsetup/m/config"
"backendsetup/m/db"
"backendsetup/m/routes"
"backendsetup/m/services"
"fmt"
"log"
"net/http"
"github.com/coreos/go-oidc/v3/oidc"
)
func main() {
config, err := config.LoadConfig()
if err != nil {
log.Fatalf("Error loading config: %v", err)
}
queries := db.Init(config)
oidcProvider := services.InitOIDC(config)
fmt.Println("hello")
verifier:= oidcProvider.Verifier(&oidc.Config{ClientID: config.OIDCClientID})
fmt.Println("hello")
engine := routes.Init(verifier, config, queries)
fmt.Println("hello")
fmt.Println(config.AppPort)
fmt.Printf("listening on: %s:%d","0.0.0.0", config.AppPort)
server := &http.Server{
Addr: fmt.Sprintf("%s:%d", "0.0.0.0", config.AppPort),
Handler: engine,
}
err = server.ListenAndServe()
if err != nil {
log.Fatalf("Error starting server: %v", err)
}
}