aboutsummaryrefslogtreecommitdiffstats
path: root/commands/webui.go
diff options
context:
space:
mode:
authorLuke Granger-Brown <git@lukegb.com>2020-06-18 02:52:33 +0100
committerMichael Muré <batolettre@gmail.com>2020-06-27 22:56:10 +0200
commit4a28f25347addf05708cdff37ecace4139f01779 (patch)
tree145e5fd420f70b182d66a5824d76300b5307d509 /commands/webui.go
parent23228101a2a38a139f6fc2cafc18e9f08d911089 (diff)
downloadgit-bug-4a28f25347addf05708cdff37ecace4139f01779.tar.gz
Add support for read-only mode for web UI.
Fixes #402.
Diffstat (limited to 'commands/webui.go')
-rw-r--r--commands/webui.go11
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")
}