MCPcopy Create free account
hub / github.com/nhost/nhost / console

Function console

cli/dockercompose/graphql.go:100–213  ·  view source on GitHub ↗
( //nolint:funlen
	cfg *model.ConfigConfig,
	subdomain string,
	httpPort uint,
	useTLS bool,
	nhostFolder string,
	port uint,
)

Source from the content-addressed store, hash-verified

98}
99
100func console( //nolint:funlen
101 cfg *model.ConfigConfig,
102 subdomain string,
103 httpPort uint,
104 useTLS bool,
105 nhostFolder string,
106 port uint,
107) (*Service, error) {
108 if semver.Compare(*cfg.GetHasura().GetVersion(), minimumHasuraVerson) < 0 {
109 return nil, fmt.Errorf( //nolint:err113
110 "hasura version must be at least %s",
111 minimumHasuraVerson,
112 )
113 }
114
115 scheme := schemeHTTP
116 if useTLS {
117 scheme = schemeHTTPS
118 }
119
120 envars, err := appconfig.HasuraEnv(
121 cfg,
122 subdomain,
123 "local",
124 "nhost.run",
125 "postgres://nhost_hasura@postgres:5432/local",
126 URL(subdomain, "dashboard", httpPort, useTLS),
127 useTLS,
128 httpPort,
129 )
130 if err != nil {
131 return nil, fmt.Errorf("failed to get hasura env vars: %w", err)
132 }
133
134 extraHosts := extraHosts(subdomain)
135 for i, host := range extraHosts {
136 if strings.HasPrefix(host, subdomain+".hasura.local.nhost.run") {
137 extraHosts[i] = subdomain + ".hasura.local.nhost.run:0.0.0.0"
138 }
139 }
140
141 env := make(map[string]string, len(envars))
142 for _, v := range envars {
143 if v.Name == "HASURA_GRAPHQL_CORS_DOMAIN" && v.Value != "*" {
144 v.Value += "," + URL("*", "hasura", httpPort, useTLS)
145 }
146
147 env[v.Name] = v.Value
148 }
149
150 return &Service{
151 Image: fmt.Sprintf(
152 "nhost/graphql-engine:%s.cli-migrations-v3",
153 *cfg.GetHasura().GetVersion(),
154 ),
155 Command: []string{
156 "bash", "-c",
157 fmt.Sprintf(`

Callers 3

consoleCloudFunction · 0.85
getServicesFunction · 0.85
TestConsoleFunction · 0.85

Calls 8

URLFunction · 0.85
extraHostsFunction · 0.85
traefikHostMatchFunction · 0.85
portsFunction · 0.85
GetHasuraMethod · 0.80
ErrorfMethod · 0.80
GetVersionMethod · 0.65
LabelsMethod · 0.45

Tested by 1

TestConsoleFunction · 0.68