-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
33 lines (25 loc) · 820 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
package main
import (
"github.com/joho/godotenv"
"github.com/vonhraban/secret-server/app/config"
"github.com/vonhraban/secret-server/app/http"
"github.com/vonhraban/secret-server/core/log"
"github.com/vonhraban/secret-server/persistence"
"github.com/vonhraban/secret-server/secret"
)
func init() {
// we want to ignore errors here , env file is not required
_ = godotenv.Load()
}
func main() {
cfg, err := config.New()
if err != nil {
panic(err)
}
logger := log.NewLogrusLogger(cfg.LogLevel)
logger.Infof("Config %s", cfg.Printable())
clock := &secret.TimeClock{}
vault := persistence.NewMongoVault(clock, cfg.MongoHost, cfg.MongoPort, cfg.MongoDatabase, cfg.MongoUsername, cfg.MongoPassword)
httpService := http.New(vault, clock, logger, cfg.ServerPort, cfg.ApiVersion)
httpService.Serve()
}