mirror of https://github.com/fluxcd/flagger.git
Merge pull request #604 from weaveworks/cors-allow-origins
Add allow origins field to CORS spec
This commit is contained in:
commit
33076941b9
|
|
@ -705,6 +705,12 @@ type CorsPolicy struct {
|
|||
// header. Wildcard * will allow all origins.
|
||||
AllowOrigin []string `json:"allowOrigin,omitempty"`
|
||||
|
||||
// String patterns that match allowed origins. An origin is allowed if
|
||||
// any of the string matchers match. If a match is found, then the
|
||||
// outgoing Access-Control-Allow-Origin would be set to the origin as
|
||||
// provided by the client.
|
||||
AllowOrigins []*v1alpha1.StringMatch `json:"allowOrigins,omitempty"`
|
||||
|
||||
// List of HTTP methods allowed to access the resource. The content will
|
||||
// be serialized into the Access-Control-Allow-Methods header.
|
||||
AllowMethods []string `json:"allowMethods,omitempty"`
|
||||
|
|
|
|||
|
|
@ -80,6 +80,17 @@ func (in *CorsPolicy) DeepCopyInto(out *CorsPolicy) {
|
|||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.AllowOrigins != nil {
|
||||
in, out := &in.AllowOrigins, &out.AllowOrigins
|
||||
*out = make([]*v1alpha1.StringMatch, len(*in))
|
||||
for i := range *in {
|
||||
if (*in)[i] != nil {
|
||||
in, out := &(*in)[i], &(*out)[i]
|
||||
*out = new(v1alpha1.StringMatch)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
}
|
||||
if in.AllowMethods != nil {
|
||||
in, out := &in.AllowMethods, &out.AllowMethods
|
||||
*out = make([]string, len(*in))
|
||||
|
|
|
|||
Loading…
Reference in New Issue