@@ -22,6 +22,19 @@ type RegistryConfig struct {
2222 URL string `json:"url"`
2323}
2424
25+ func (config * RegistryConfig ) Pretty () string {
26+ pretty_type := "other"
27+
28+ switch config .Type {
29+ case GIT_SOURCE :
30+ pretty_type = "Git Source"
31+ case GOPROXY_SERVER :
32+ pretty_type = "GOPROXY Server"
33+ }
34+
35+ return fmt .Sprintf ("`%s` (%s)" , config .URL , pretty_type )
36+ }
37+
2538// The address of the proxy including protocol and port (e.g. http://localhost:1234)
2639var proxy_address string
2740
@@ -97,18 +110,22 @@ func getEnvVars() []string {
97110 if err != nil {
98111 slog .Error ("Unable to parse proxy configurations" , slog .String ("error" , err .Error ()))
99112 } else {
113+ activeConfigs := []RegistryConfig {}
114+
100115 // We only care about private registry configurations that are relevant to Go and
101116 // filter others out at this point.
102117 for _ , cfg := range val {
103118 if cfg .Type == GOPROXY_SERVER {
104119 goproxy_servers = append (goproxy_servers , cfg .URL )
105120 slog .Info ("Found GOPROXY server" , slog .String ("url" , cfg .URL ))
121+ activeConfigs = append (activeConfigs , cfg )
106122 } else if cfg .Type == GIT_SOURCE {
107123 parsed , err := url .Parse (cfg .URL )
108124 if err == nil && parsed .Hostname () != "" {
109125 git_source := parsed .Hostname () + parsed .Path + "*"
110126 git_sources = append (git_sources , git_source )
111127 slog .Info ("Found Git source" , slog .String ("source" , git_source ))
128+ activeConfigs = append (activeConfigs , cfg )
112129 } else {
113130 slog .Warn ("Not a valid URL for Git source" , slog .String ("url" , cfg .URL ))
114131 }
0 commit comments