aboutsummaryrefslogtreecommitdiffstats
path: root/commands/webui.go
diff options
context:
space:
mode:
authorLuke Granger-Brown <git@lukegb.com>2020-06-18 03:11:38 +0100
committerMichael Muré <batolettre@gmail.com>2020-06-27 22:56:11 +0200
commitdfdb5e090b9368d336cb7552c8c462bef243fbb0 (patch)
tree2b9a9ddf20c7c7023e8599430f5489779af27a31 /commands/webui.go
parent43c78da02ecd2d49a45632e5b3270cd0c9da474f (diff)
downloadgit-bug-dfdb5e090b9368d336cb7552c8c462bef243fbb0.tar.gz
Verify that we have an identity only in read-write mode
Diffstat (limited to 'commands/webui.go')
-rw-r--r--commands/webui.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/commands/webui.go b/commands/webui.go
index 87ccf5d4..e1f592df 100644
--- a/commands/webui.go
+++ b/commands/webui.go
@@ -20,6 +20,7 @@ import (
"github.com/MichaelMure/git-bug/graphql"
"github.com/MichaelMure/git-bug/graphql/config"
+ "github.com/MichaelMure/git-bug/identity"
"github.com/MichaelMure/git-bug/repository"
"github.com/MichaelMure/git-bug/util/git"
"github.com/MichaelMure/git-bug/webui"
@@ -43,6 +44,13 @@ func runWebUI(cmd *cobra.Command, args []string) error {
}
}
+ if !webUIReadOnly {
+ // Verify that we have an identity.
+ if _, err := identity.GetUserIdentity(repo); err != nil {
+ return err
+ }
+ }
+
addr := fmt.Sprintf("127.0.0.1:%d", webUIPort)
webUiAddr := fmt.Sprintf("http://%s", addr)
@@ -253,7 +261,7 @@ var webUICmd = &cobra.Command{
Available git config:
git-bug.webui.open [bool]: control the automatic opening of the web UI in the default browser
`,
- PreRunE: loadRepoEnsureUser,
+ PreRunE: loadRepo,
RunE: runWebUI,
}