@@ -122,13 +122,32 @@ func (a *authorizer) GetInfoByDomain(_ context.Context, domain string) (*ocmprov
122
122
// check if the domain matches a regex
123
123
if ok , err := regexp .MatchString (p .Domain , normalizedDomain ); ok && err == nil {
124
124
// overwrite wildcards with the actual domain
125
- for i , s := range p .Services {
126
- s .Endpoint .Path = strings .ReplaceAll (s .Endpoint .Path , p .Domain , normalizedDomain )
127
- s .Host = strings .ReplaceAll (s .Host , p .Domain , normalizedDomain )
128
- p .Services [i ] = s
125
+ var services []* ocmprovider.Service
126
+ for _ , s := range p .Services {
127
+ services = append (services , & ocmprovider.Service {
128
+ Host : strings .ReplaceAll (s .Host , p .Domain , normalizedDomain ),
129
+ Endpoint : & ocmprovider.ServiceEndpoint {
130
+ Type : s .Endpoint .Type ,
131
+ Name : s .Endpoint .Name ,
132
+ Path : strings .ReplaceAll (s .Endpoint .Path , p .Domain , normalizedDomain ),
133
+ IsMonitored : s .Endpoint .IsMonitored ,
134
+ Properties : s .Endpoint .Properties ,
135
+ },
136
+ ApiVersion : s .ApiVersion ,
137
+ AdditionalEndpoints : s .AdditionalEndpoints ,
138
+ })
129
139
}
130
- p .Domain = normalizedDomain
131
- return p , nil
140
+ return & ocmprovider.ProviderInfo {
141
+ Name : p .Name ,
142
+ FullName : p .FullName ,
143
+ Description : p .Description ,
144
+ Organization : p .Organization ,
145
+ Domain : normalizedDomain ,
146
+ Homepage : p .Homepage ,
147
+ Email : p .Email ,
148
+ Services : services ,
149
+ Properties : p .Properties ,
150
+ }, nil
132
151
}
133
152
}
134
153
return nil , errtypes .NotFound (domain )
0 commit comments