diff options
author | Luke Granger-Brown <git@lukegb.com> | 2020-06-18 02:52:33 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-06-27 22:56:10 +0200 |
commit | 4a28f25347addf05708cdff37ecace4139f01779 (patch) | |
tree | 145e5fd420f70b182d66a5824d76300b5307d509 /commands | |
parent | 23228101a2a38a139f6fc2cafc18e9f08d911089 (diff) | |
download | git-bug-4a28f25347addf05708cdff37ecace4139f01779.tar.gz |
Add support for read-only mode for web UI.
Fixes #402.
Diffstat (limited to 'commands')
-rw-r--r-- | commands/webui.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/commands/webui.go b/commands/webui.go index 5d3d4b4a..7a0fb2cd 100644 --- a/commands/webui.go +++ b/commands/webui.go @@ -19,15 +19,17 @@ import ( "github.com/spf13/cobra" "github.com/MichaelMure/git-bug/graphql" + "github.com/MichaelMure/git-bug/graphql/config" "github.com/MichaelMure/git-bug/repository" "github.com/MichaelMure/git-bug/util/git" "github.com/MichaelMure/git-bug/webui" ) var ( - webUIPort int - webUIOpen bool - webUINoOpen bool + webUIPort int + webUIOpen bool + webUINoOpen bool + webUIReadOnly bool ) const webUIOpenConfigKey = "git-bug.webui.open" @@ -46,7 +48,7 @@ func runWebUI(cmd *cobra.Command, args []string) error { router := mux.NewRouter() - graphqlHandler, err := graphql.NewHandler(repo) + graphqlHandler, err := graphql.NewHandler(repo, config.Config{ReadOnly: webUIReadOnly}) if err != nil { return err } @@ -261,5 +263,6 @@ func init() { webUICmd.Flags().BoolVar(&webUIOpen, "open", false, "Automatically open the web UI in the default browser") webUICmd.Flags().BoolVar(&webUINoOpen, "no-open", false, "Prevent the automatic opening of the web UI in the default browser") webUICmd.Flags().IntVarP(&webUIPort, "port", "p", 0, "Port to listen to (default is random)") + webUICmd.Flags().BoolVar(&webUIReadOnly, "read-only", false, "Whether to run the web UI in read-only mode") } |