-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
34 lines (28 loc) · 676 Bytes
/
main.go
File metadata and controls
34 lines (28 loc) · 676 Bytes
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 (
"fmt"
"github.com/pkg/errors"
"github.com/sdvcrx/cuttlefish/config"
"github.com/sdvcrx/cuttlefish/log"
"github.com/spf13/viper"
)
var (
version = "dev"
commit = "none"
date = "unknown"
logger = log.Logger
)
func main() {
if viper.GetBool("version") {
fmt.Printf("%s %s %s\n", version, commit, date)
return
}
log.SetLevel(viper.GetBool("verbose"))
config.Load()
InitSignals()
server := NewProxyServer()
logger.Info().Msgf("Proxy server is listening on %s", server.Addr)
if err := server.ListenAndServe(); err != nil {
logger.Fatal().Err(errors.Wrap(err, "server.ListenAndServe")).Msg("Failed to start proxy server")
}
}