fup/cmd/serve: add viper bindings for all the flags
This commit is contained in:
parent
5b74ceec4e
commit
d96cf3d34d
1 changed files with 7 additions and 0 deletions
|
@ -15,6 +15,7 @@ import (
|
|||
"github.com/coreos/go-systemd/v22/activation"
|
||||
"github.com/google/safehtml"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"hg.lukegb.com/lukegb/depot/web/fup/fuphttp"
|
||||
"hg.lukegb.com/lukegb/depot/web/fup/fupstatic"
|
||||
"hg.lukegb.com/lukegb/depot/web/fup/minicheddar"
|
||||
|
@ -24,12 +25,18 @@ func init() {
|
|||
rootCmd.AddCommand(serveCmd)
|
||||
|
||||
serveCmd.Flags().StringVar(&serveRoot, "root", "http://localhost:8191/", "Application root address.")
|
||||
viper.BindPFlag("serve.app-root", serveCmd.Flags().Lookup("root"))
|
||||
serveCmd.Flags().StringVar(&serveStaticRoot, "static-root", "/static/", "Root address from which static assets should be referenced.")
|
||||
viper.BindPFlag("serve.static-root", serveCmd.Flags().Lookup("static-root"))
|
||||
serveCmd.Flags().StringVarP(&serveBind, "listen", "l", ":8191", "Bind address for HTTP server.")
|
||||
viper.BindPFlag("serve.listen", serveCmd.Flags().Lookup("listen"))
|
||||
serveCmd.Flags().BoolVar(&serveDirectOnly, "direct-only", false, "If set, all file serving will be proxied, even if the backend supports signed URLs.")
|
||||
viper.BindPFlag("serve.direct-only", serveCmd.Flags().Lookup("direct-only"))
|
||||
|
||||
serveCmd.Flags().StringVar(&serveCheddarPath, "cheddar-path", "cheddar", "Path to 'cheddar' binary to use for syntax highlighting. If it cannot be found, syntax highlighting and markdown rendering will be disabled.")
|
||||
viper.BindPFlag("serve.cheddar.path", serveCmd.Flags().Lookup("cheddar-path"))
|
||||
serveCmd.Flags().StringVar(&serveCheddarAddr, "cheddar-address", "", "If non-empty, will be used instead of attempting to spawn a copy of cheddar.")
|
||||
viper.BindPFlag("serve.cheddar.address", serveCmd.Flags().Lookup("cheddar-address"))
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
Loading…
Reference in a new issue