MCPcopy Create free account
hub / github.com/SignTools/SignTools / main

Function main

main.go:63–91  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61}
62
63func main() {
64 host := flag.String("host", "", "Listen host, empty for all")
65 port := flag.Uint64("port", 8080, "Listen port")
66 configFile := flag.String("config", "signer-cfg.yml", "Configuration file")
67 ngrokHost := flag.String("ngrok-host", "", "Ngrok web interface host. "+
68 "Used to automatically parse the server_url")
69 cloudflaredHost := flag.String("cloudflared-host", "", "cloudflared metrics host. "+
70 "Used to automatically parse the server_url")
71 logJson := flag.Bool("log-json", false, "If enabled, outputs logs in JSON instead of pretty printing them.")
72 logLevel := flag.Uint("log-level", uint(zerolog.InfoLevel), "Logging level, 0 (debug) - 5 (panic).")
73 flag.Parse()
74
75 zerolog.SetGlobalLevel(zerolog.Level(*logLevel))
76 if !*logJson {
77 log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
78 }
79
80 config.Load(*configFile)
81 storage.Load()
82 switch {
83 case *ngrokHost != "":
84 config.Current.ServerUrl = getPublicUrlFatal(&tunnel.Ngrok{Host: *ngrokHost, Proto: "https"})
85 case *cloudflaredHost != "":
86 config.Current.ServerUrl = getPublicUrlFatal(&tunnel.Cloudflare{Host: *cloudflaredHost})
87 }
88
89 log.Info().Str("url", config.Current.ServerUrl).Msg("using server url")
90 serve(*host, *port)
91}
92
93func getPublicUrlFatal(provider tunnel.Provider) string {
94 log.Info().Msg("obtaining server url")

Callers

nothing calls this directly

Calls 4

LoadFunction · 0.92
LoadFunction · 0.92
getPublicUrlFatalFunction · 0.85
serveFunction · 0.85

Tested by

no test coverage detected