Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions internal/client/project/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func (e Environment) Proto(name, version string) (*pb.Environment, error) {
Cookies: e.Ingress.Cookies, // Depreciated.
Proxy: protoProxy(e.Ingress.Proxy),
ErrorPages: protoErrorPages(e.Ingress.ErrorPages),
Origin: protoIngressOrigin(e.Ingress.Origin),
},
SMTP: &pb.SMTP{
Address: e.SMTP.From.Address,
Expand Down Expand Up @@ -131,6 +132,17 @@ func protoIngressCache(cache Cache) *pb.Cache {
}
}

// Helper function to convert ingress cache config to proto format.
func protoIngressOrigin(origin Origin) *pb.Origin {
if origin.Policy == "" {
return nil
}

return &pb.Origin{
Policy: origin.Policy,
}
}

// Helper function to convert proxy config to proto format.
func protoProxy(config IngressSpecProxyList) []*pb.Proxy {
var list []*pb.Proxy
Expand Down
6 changes: 6 additions & 0 deletions internal/client/project/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,19 @@ type Ingress struct {
Cookies []string `yaml:"cookies,omitempty" json:"cookies,omitempty"`
Proxy IngressSpecProxyList `yaml:"proxy,omitempty" json:"proxy,omitempty"`
ErrorPages IngressSpecErrorPages `yaml:"errorPages,omitempty" json:"errorPages,omitempty"`
Origin Origin `yaml:"origin,omitempty" json:"origin,omitempty"`
}

// Cache covers the cache policy to be included from CloudFront
type Cache struct {
Policy string `yaml:"policy,omitempty" json:"policy,omitempty"`
}

// Origin covers the origin request policy to be included from CloudFront
type Origin struct {
Policy string `yaml:"policy,omitempty" json:"policy,omitempty"`
}

// IngressSpecProxyList of proxy rules for an Environment.
type IngressSpecProxyList map[string]IngressSpecProxy

Expand Down