-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
34 lines (29 loc) · 775 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
package main
import (
"context"
"encoding/gob"
"github.com/dark-enstein/vault/pkg/vlog"
"github.com/dark-enstein/vault/service"
"github.com/spf13/pflag"
)
type InitConfig struct {
debug bool
}
func init() {
gob.Register(map[string]string{})
}
func main() {
var i = InitConfig{}
pflag.BoolVarP(&i.debug, "debug", "d", true, "enable debug mode")
pflag.Parse()
// starting
ctx := context.Background()
logger := vlog.New(i.debug)
srv, err := service.New(ctx, logger, service.WithStoreStr(service.STORE_FILE), service.WithFileLoc("./gob"))
if err != nil {
logger.Logger().Fatal().Msgf("error while setting up service: %w", err)
}
if err = srv.Run(ctx); err != nil {
logger.Logger().Fatal().Msgf("error while service is starting: %s\n", err.Error())
}
}