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

Function cloud

cli/cmd/dev/cloud.go:143–258  ·  view source on GitHub ↗
( //nolint:funlen
	ctx context.Context,
	ce *clienv.CliEnv,
	appVersion string,
	dc *dockercompose.DockerCompose,
	httpPort uint,
	useTLS bool,
	applySeeds bool,
	ports dockercompose.ExposePorts,
	dashboardVersion string,
	configserverImage string,
	caCertificatesPath string,
	proj *graphql.AppSummaryFragment,
	postgresURL string,
)

Source from the content-addressed store, hash-verified

141}
142
143func cloud( //nolint:funlen
144 ctx context.Context,
145 ce *clienv.CliEnv,
146 appVersion string,
147 dc *dockercompose.DockerCompose,
148 httpPort uint,
149 useTLS bool,
150 applySeeds bool,
151 ports dockercompose.ExposePorts,
152 dashboardVersion string,
153 configserverImage string,
154 caCertificatesPath string,
155 proj *graphql.AppSummaryFragment,
156 postgresURL string,
157) error {
158 ctx, cancel := context.WithCancel(ctx)
159
160 sigChan := make(chan os.Signal, 1)
161 signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM, os.Interrupt)
162
163 go func() {
164 <-sigChan
165 cancel()
166 }()
167
168 ce.Infoln("Validating configuration...")
169
170 cfg, cfgSecrets, err := config.ValidateRemote(
171 ctx,
172 ce,
173 proj.GetSubdomain(),
174 proj.GetID(),
175 )
176 if err != nil {
177 return fmt.Errorf("failed to validate configuration: %w", err)
178 }
179
180 ctxWithTimeout, cancel := context.WithTimeout(ctx, 5*time.Second) //nolint:mnd
181 defer cancel()
182
183 ce.Infoln("Checking versions...")
184
185 if err := software.CheckVersions(ctxWithTimeout, ce, cfgSecrets, appVersion); err != nil {
186 ce.Warnln("Problem verifying recommended versions: %s", err.Error())
187 }
188
189 ce.Infoln("Setting up Nhost development environment...")
190
191 composeFile, err := dockercompose.CloudComposeFileFromConfig(
192 cfgSecrets,
193 ce.LocalSubdomain(),
194 proj.GetSubdomain(),
195 proj.GetRegion().GetName(),
196 cfgSecrets.Hasura.GetAdminSecret(),
197 postgresURL,
198 ce.ProjectName(),
199 httpPort,
200 useTLS,

Callers 1

CloudFunction · 0.85

Calls 15

HasuraWrapperMethod · 0.95
ValidateRemoteFunction · 0.92
CheckVersionsFunction · 0.92
ApplyFunction · 0.92
NhostHasuraURLFunction · 0.92
NewDockerFunction · 0.92
migrationsFunction · 0.85
printCloudInfoFunction · 0.85
InfolnMethod · 0.80
GetSubdomainMethod · 0.80
ErrorfMethod · 0.80

Tested by

no test coverage detected