From 4294c19eacd71d2cdb3d81ad137c40c2505aebce Mon Sep 17 00:00:00 2001 From: David Barroso Date: Tue, 20 Aug 2024 15:47:08 +0200 Subject: [PATCH] fix: set correct extraHosts for the console (#899) * fix: set correct extraHosts for the console --- dockercompose/graphql.go | 10 +++++++++- dockercompose/graphql_test.go | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dockercompose/graphql.go b/dockercompose/graphql.go index e463d6f9..9076e5e3 100644 --- a/dockercompose/graphql.go +++ b/dockercompose/graphql.go @@ -2,6 +2,7 @@ package dockercompose import ( "fmt" + "strings" "github.com/nhost/be/services/mimir/model" "github.com/nhost/be/services/mimir/schema/appconfig" @@ -117,6 +118,13 @@ func console( //nolint:funlen return nil, fmt.Errorf("failed to get hasura env vars: %w", err) } + extraHosts := extraHosts(subdomain) + for i, host := range extraHosts { + if strings.HasPrefix(host, subdomain+".hasura") { + extraHosts[i] = subdomain + ".hasura.local.nhost.run:0.0.0.0" + } + } + env := make(map[string]string, len(envars)) for _, v := range envars { if v.Name == "HASURA_GRAPHQL_CORS_DOMAIN" && v.Value != "*" { @@ -149,7 +157,7 @@ func console( //nolint:funlen }, EntryPoint: nil, Environment: env, - ExtraHosts: extraHosts(subdomain), + ExtraHosts: extraHosts, HealthCheck: &HealthCheck{ Test: []string{ "CMD-SHELL", diff --git a/dockercompose/graphql_test.go b/dockercompose/graphql_test.go index b5c4dc38..b8877770 100644 --- a/dockercompose/graphql_test.go +++ b/dockercompose/graphql_test.go @@ -194,7 +194,7 @@ func expectedConsole() *Service { "dev.db.local.nhost.run:host-gateway", "dev.functions.local.nhost.run:host-gateway", "dev.graphql.local.nhost.run:host-gateway", - "dev.hasura.local.nhost.run:host-gateway", + "dev.hasura.local.nhost.run:0.0.0.0", "dev.storage.local.nhost.run:host-gateway", }, HealthCheck: &HealthCheck{