From 8e38353bc94c0b245f160998f3e5addae3ac9848 Mon Sep 17 00:00:00 2001 From: Sajad Date: Sun, 27 Nov 2022 08:54:32 +0530 Subject: [PATCH] add environment variables support for provider config (#257) --- pkg/schema/schema.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/schema/schema.go b/pkg/schema/schema.go index c9045d9..395150e 100644 --- a/pkg/schema/schema.go +++ b/pkg/schema/schema.go @@ -3,6 +3,7 @@ package schema import ( "context" "fmt" + "os" "sync" "github.com/projectdiscovery/cloudlist/pkg/schema/validate" @@ -135,5 +136,12 @@ func (o OptionBlock) GetMetadata(key string) (string, bool) { if !ok || data == "" { return "", false } + // if data starts with $, treat it as an env var + if data[0] == '$' { + envData := os.Getenv(data[1:]) + if envData != "" { + return envData, true + } + } return data, true }