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

Function InitRemote

cli/cmd/project/init.go:160–190  ·  view source on GitHub ↗
(
	ctx context.Context,
	ce *clienv.CliEnv,
)

Source from the content-addressed store, hash-verified

158}
159
160func InitRemote(
161 ctx context.Context,
162 ce *clienv.CliEnv,
163) error {
164 ep, err := ce.ResolveProject(ctx, "")
165 if err != nil {
166 return fmt.Errorf("failed to resolve project: %w", err)
167 }
168
169 cfg, err := config.Pull(ctx, ce, ep.App, true)
170 if err != nil {
171 return fmt.Errorf("failed to pull config: %w", err)
172 }
173
174 if err := initInit(ce.Path); err != nil {
175 return err
176 }
177
178 adminSecret, err := ep.AdminSecret(ctx)
179 if err != nil {
180 return fmt.Errorf("failed to get admin secret: %w", err)
181 }
182
183 if err := deploy(ctx, ce, cfg, ep.HasuraURL, adminSecret); err != nil {
184 return fmt.Errorf("failed to deploy: %w", err)
185 }
186
187 ce.Infoln("Project initialized successfully!")
188
189 return nil
190}
191
192func deploy(
193 ctx context.Context,

Callers 1

commandInitFunction · 0.85

Calls 7

PullFunction · 0.92
initInitFunction · 0.85
deployFunction · 0.85
ResolveProjectMethod · 0.80
ErrorfMethod · 0.80
AdminSecretMethod · 0.80
InfolnMethod · 0.80

Tested by

no test coverage detected