diff --git a/cmd/rio/main.go b/cmd/rio/main.go index edd5c60..08eec7e 100644 --- a/cmd/rio/main.go +++ b/cmd/rio/main.go @@ -78,7 +78,6 @@ func Handler(pagesDomain, giteaUrl string, giteaClient *gitea.Client) http.Handl } func runServer(ctx *cli.Context) error { - log.SetLevel(log.DebugLevel) giteaUrl := ctx.String("gitea-url") domain := ctx.String("pages-domain") certsFile := ctx.String("certs-file") @@ -89,6 +88,13 @@ func runServer(ctx *cli.Context) error { acmePort := ctx.String("acme-port") acmeDisable := ctx.Bool("acme-disable") + // Init Logging + if ctx.Bool("debug") { + log.SetLevel(log.DebugLevel) + } else { + log.SetLevel(log.InfoLevel) + } + // Setup the Gitea stuff httpClient := http.Client{Timeout: 10 * time.Second} client, err := gitea.NewClient( @@ -237,6 +243,11 @@ func main() { Usage: "Whether to disable automatic ACME certificates", EnvVars: []string{"ACME_DISABLE"}, }, + &cli.BoolFlag{ + Name: "debug", + Usage: "Whether to enable debug logging", + EnvVars: []string{"DEBUG_ENABLE"}, + }, }, }