Skip to content

Commit

Permalink
add environment variables support for provider config (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
parrasajad committed Nov 27, 2022
1 parent 89a3192 commit 8e38353
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package schema
import (
"context"
"fmt"
"os"
"sync"

"github.com/projectdiscovery/cloudlist/pkg/schema/validate"
Expand Down Expand Up @@ -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
}

0 comments on commit 8e38353

Please sign in to comment.