这是indexloc提供的服务,不要输入任何密码
Skip to content
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
11 changes: 11 additions & 0 deletions v2/pkg/passive/sources.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package passive

import (
"fmt"
"os"
"strings"

"golang.org/x/exp/maps"
Expand Down Expand Up @@ -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)}

Expand Down
Loading