Skip to content

Commit

Permalink
Add gRPC as valid endpoint type (#69)
Browse files Browse the repository at this point in the history
* Add gRPC as valid endpoint type

* missing error message
  • Loading branch information
mdelaossa authored Oct 10, 2024
1 parent 44b924c commit cc04d04
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions aptible/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (c *Client) CreateEndpoint(service Service, attrs EndpointCreateAttrs) (End
request.ContainerPort = attrs.ContainerPort
}

if *attrs.Type != "http_proxy_protocol" && *attrs.Type != "http" {
if *attrs.Type != "http_proxy_protocol" && *attrs.Type != "http" && *attrs.Type != "grpc" {
request.ContainerPorts = attrs.ContainerPorts
}

Expand Down Expand Up @@ -285,8 +285,10 @@ func GetEndpointType(t string) (string, error) {
return "tcp", nil
case "TLS", "tls":
return "tls", nil
case "GRPC", "gRPC", "grpc":
return "grpc", nil
default:
e := fmt.Errorf("invalid endpoint type, please use HTTPS, TLS, or TCP")
e := fmt.Errorf("invalid endpoint type, please use HTTPS, TLS, GRPC, or TCP")
return "", e
}
}
Expand All @@ -299,6 +301,8 @@ func GetHumanReadableEndpointType(t string) (string, error) {
return "tcp", nil
case "tls":
return "tls", nil
case "grpc":
return "grpc", nil
default:
e := fmt.Errorf("invalid endpoint type - %s", t)
return "", e
Expand Down

0 comments on commit cc04d04

Please sign in to comment.