mirror of
https://github.com/projectdiscovery/subfinder
synced 2026-06-21 14:05:24 +00:00
read key from env if provided (#1607)
* read key from env if provided * remove debug code
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package passive
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/exp/maps"
|
||||
@@ -168,6 +170,15 @@ func New(sourceNames, excludedSourceNames []string, useAllSources, useSourcesSup
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Consider refactoring this to avoid potential duplication issues
|
||||
for _, source := range sources {
|
||||
if source.NeedsKey() {
|
||||
if apiKey := os.Getenv(fmt.Sprintf("%s_API_KEY", strings.ToUpper(source.Name()))); apiKey != "" {
|
||||
source.AddApiKeys([]string{apiKey})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create the agent, insert the sources and remove the excluded sources
|
||||
agent := &Agent{sources: maps.Values(sources)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user