Skip to content

Commit be4a8b3

Browse files
authored
feat: Allow empty host on WithRoute (#67)
Envoy requires unique domains for all virtual hosts within the same route configuration. This was causing issues with multiple services registering under the same domain/host through fuse. This PR removes the requirement to specify a host when registering routes and #65 updates fuse to add routes with no defined host to a default virtual host. Oh and I also added a `Ping()` call to the `repositories/postgres/bun` client's `Open()` so that the database connection is actually verified on boot.
1 parent 03f77fb commit be4a8b3

2 files changed

Lines changed: 1 addition & 7 deletions

File tree

pkg/chassis/networking.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ func (c *Runtime) setAndValidateRoute(route *ntv1.Route) *ntv1.Route {
7676
if route.Match == nil {
7777
c.logger.Panic("route requested but no match provided")
7878
}
79-
if route.Match.Host == "" {
80-
route.Match.Host = c.config.GetString("service.network.external.host")
81-
}
82-
if route.Match.Host == "" {
83-
c.logger.Panic("route requested but no host provided in the match")
84-
}
8579
if route.Endpoint == nil {
8680
route.Endpoint = &ntv1.Endpoint{
8781
Host: c.getConfigInternalHost(),

pkg/repositories/postgres/bun/bun.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (r *repository) Open(ctx context.Context, config chassis.Config) error {
4444
sqldb := sql.OpenDB(pgdriver.NewConnector(pgdriver.WithDSN(url)))
4545
client := bun.NewDB(sqldb, pgdialect.New())
4646
r.client = client
47-
return nil
47+
return r.Ping(ctx)
4848
}
4949

5050
func (r *repository) Close(ctx context.Context) error {

0 commit comments

Comments
 (0)