From 28238cb01fe95d44a6cae9dbd37464c947551984 Mon Sep 17 00:00:00 2001 From: Laurence Jones Date: Mon, 9 Oct 2023 11:36:05 +0100 Subject: [PATCH] reverse nil statement instead of else (#2530) --- pkg/exprhelpers/crowdsec_cti.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/exprhelpers/crowdsec_cti.go b/pkg/exprhelpers/crowdsec_cti.go index 2aa0c534a..e7418a5c4 100644 --- a/pkg/exprhelpers/crowdsec_cti.go +++ b/pkg/exprhelpers/crowdsec_cti.go @@ -25,12 +25,11 @@ var CTIBackOffDuration time.Duration = 5 * time.Minute var ctiClient *cticlient.CrowdsecCTIClient func InitCrowdsecCTI(Key *string, TTL *time.Duration, Size *int, LogLevel *log.Level) error { - if Key != nil { - CTIApiKey = *Key - } else { + if Key == nil { CTIApiEnabled = false return fmt.Errorf("CTI API key not set, CTI will not be available") } + CTIApiKey = *Key if Size == nil { Size = new(int) *Size = 1000