From fe59930b6e0156ad8e973f48844cf583bd1eaec1 Mon Sep 17 00:00:00 2001 From: Preslav Date: Thu, 21 Sep 2023 11:17:49 +0300 Subject: [PATCH] small code improvement. --- explorer/scan/local_scanner.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/explorer/scan/local_scanner.go b/explorer/scan/local_scanner.go index 92e4fb1b05..27c3f3f52b 100644 --- a/explorer/scan/local_scanner.go +++ b/explorer/scan/local_scanner.go @@ -111,12 +111,12 @@ func (s *LocalScanner) Run(ctx context.Context, job *Job) (*explorer.ReportColle // returns the upstream config for the job. If the job has a specified config, it has precedence // over the automatically detected one func (s *LocalScanner) getUpstreamConfig(inv *inventory.Inventory, incognito bool) (*upstream.UpstreamConfig, error) { - if s.upstream == nil && inv.Spec.GetUpstreamCredentials() == nil { + jobCreds := inv.GetSpec().GetUpstreamCredentials() + if s.upstream == nil && jobCreds == nil { return nil, errors.New("no default or job upstream config provided") } u := proto.Clone(s.upstream).(*upstream.UpstreamConfig) u.Incognito = incognito - jobCreds := inv.GetSpec().GetUpstreamCredentials() if jobCreds != nil { u.ApiEndpoint = jobCreds.GetApiEndpoint() u.Creds = jobCreds