From 9a5c69e0f0622c9ce19c4ec915af0d08492f7708 Mon Sep 17 00:00:00 2001 From: Flavien Darche Date: Thu, 24 Oct 2024 14:17:56 +0200 Subject: [PATCH] possibility to disable appsec if force disabled --- .../envoyproxy/envoy/cmd/serviceextensions/main.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/contrib/envoyproxy/envoy/cmd/serviceextensions/main.go b/contrib/envoyproxy/envoy/cmd/serviceextensions/main.go index e893a69d7f..515c00b275 100644 --- a/contrib/envoyproxy/envoy/cmd/serviceextensions/main.go +++ b/contrib/envoyproxy/envoy/cmd/serviceextensions/main.go @@ -54,11 +54,12 @@ func loadConfig() serviceExtensionConfig { func main() { var extensionService AppsecCalloutExtensionService - // Force set ASM as enabled and set it as running in standalone mode - err := os.Setenv("DD_APPSEC_ENABLED", "1") - if err != nil { - log.Error("service_extension: failed to set environment variable: %v\n", err) - return + // Force set ASM as enabled only if the environment variable is not set + // Note: If the environment variable is set to false, it should be disabled + if os.Getenv("DD_APPSEC_ENABLED") == "" { + if err := os.Setenv("DD_APPSEC_ENABLED", "1"); err != nil { + log.Error("service_extension: failed to set DD_APPSEC_ENABLED environment variable: %v\n", err) + } } // TODO: Enable ASM standalone mode when it is developed (should be done for Q4 2024)