cmd/uplink/cmd: improve error message when config.yaml or --access flag

is missing

https://storjlabs.atlassian.net/browse/USR-78

Change-Id: I8221822d164279b85f24573df0ac05fcd6b3881e
This commit is contained in:
Michal Niewrzal 2020-04-15 13:48:29 +02:00 committed by Fadila
parent a2ce836761
commit 90bac51544

View File

@ -96,6 +96,10 @@ func (a AccessConfig) GetAccess() (_ *libuplink.Scope, err error) {
return access, nil
}
if len(a.Legacy.Client.APIKey) == 0 {
return nil, errs.New("unable to find access grant, run 'setup' command or provide '--access' parameter")
}
// fall back to trying to load the legacy values.
apiKey, err := libuplink.ParseAPIKey(a.Legacy.Client.APIKey)
if err != nil {