Skip to content

Commit

Permalink
cmd: check if config is initialized before assignment (#1116)
Browse files Browse the repository at this point in the history
  • Loading branch information
ishank011 authored Aug 24, 2020
1 parent 72380a6 commit 418797a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion changelog/unreleased/ocm-fixes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Bugfix: Minor fixes in OCM shares, gateway uploads and smtpclient
Bugfix: Minor fixes in reva cmd, gateway uploads and smtpclient

https://github.com/cs3org/reva/pull/1082
https://github.com/cs3org/reva/pull/1116
6 changes: 6 additions & 0 deletions cmd/reva/arguments.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,14 @@ func (c *Completer) shareReceivedArgumentCompleter() []prompt.Suggest {
}

func executeCommand(cmd *command, args ...string) (bytes.Buffer, error) {

var b bytes.Buffer
var err error

if conf == nil || conf.Host == "" {
return b, errors.New("reva not configured")
}

if err = cmd.Parse(args); err != nil {
return b, err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/reva/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ func (e *Executor) Execute(s string) {
args := strings.Split(s, " ")

// Verify that the configuration is set, either in memory or in a file.
if conf.Host == "" {
if conf == nil || conf.Host == "" {
c, err := readConfig()
if err != nil && args[0] != "configure" {
fmt.Println("reva is not configured, please run the configure command")
fmt.Println("reva is not configured, please pass the -host flag or run the configure command")
return
} else if args[0] != "configure" {
conf = c
Expand Down

0 comments on commit 418797a

Please sign in to comment.