File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -78,19 +78,27 @@ func LoadConfigFile(configPath string) (*ConfigResult, error) {
7878 }, nil
7979}
8080
81- // MergeRelayConfigs merges relays passed via --relays to config file settings.
81+ // MergeRelayConfigs merges relays passed via --relays with config file settings.
8282// this allows the users to still use --relays if they dont want to provide a config file
8383func MergeRelayConfigs (relays []types.RelayEntry , configMap map [string ]types.RelayConfig ) []types.RelayConfig {
84- configs := make ([]types.RelayConfig , 0 , len (relays ))
84+ configs := make ([]types.RelayConfig , 0 )
85+ processedURLs := make (map [string ]bool )
8586
8687 for _ , entry := range relays {
87- if config , exists := configMap [entry .String ()]; exists {
88+ urlStr := entry .String ()
89+ if config , exists := configMap [urlStr ]; exists {
8890 config .RelayEntry = entry
8991 configs = append (configs , config )
9092 } else {
9193 configs = append (configs , types .NewRelayConfig (entry ))
9294 }
95+ processedURLs [urlStr ] = true
9396 }
9497
98+ for urlStr , config := range configMap {
99+ if ! processedURLs [urlStr ] {
100+ configs = append (configs , config )
101+ }
102+ }
95103 return configs
96104}
You can’t perform that action at this time.
0 commit comments