Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd: check if config is initialized before assignment #1116

Merged
merged 1 commit into from
Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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