Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support to load provider keys from env #868

Merged
merged 1 commit into from
Jun 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions v2/pkg/runner/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/projectdiscovery/gologger"
"github.com/projectdiscovery/subfinder/v2/pkg/passive"
fileutil "github.com/projectdiscovery/utils/file"
)

// GetConfigDirectory gets the subfinder config directory for a user
Expand Down Expand Up @@ -42,14 +43,13 @@ func CreateProviderConfigYAML(configFilePath string, sourcesRequiringApiKeysMap

// UnmarshalFrom writes the marshaled yaml config to disk
func UnmarshalFrom(file string) error {
f, err := os.Open(file)
reader, err := fileutil.SubstituteConfigFromEnvVars(file)
if err != nil {
return err
}
defer f.Close()

sourceApiKeysMap := map[string][]string{}
err = yaml.NewDecoder(f).Decode(sourceApiKeysMap)
err = yaml.NewDecoder(reader).Decode(sourceApiKeysMap)
for _, source := range passive.AllSources {
sourceName := strings.ToLower(source.Name())
apiKeys := sourceApiKeysMap[sourceName]
Expand Down