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

Function commandValidate

cli/cmd/config/validate.go:36–73  ·  view source on GitHub ↗
(ctx context.Context, cmd *cli.Command)

Source from the content-addressed store, hash-verified

34}
35
36func commandValidate(ctx context.Context, cmd *cli.Command) error {
37 ce := clienv.FromCLI(cmd)
38
39 subdomain := cmd.String(flagSubdomain)
40 if subdomain != "" && subdomain != "local" {
41 proj, err := ce.GetAppInfo(ctx, cmd.String(flagSubdomain))
42 if err != nil {
43 return fmt.Errorf("failed to get app info: %w", err)
44 }
45
46 _, _, err = ValidateRemote(
47 ctx,
48 ce,
49 proj.GetSubdomain(),
50 proj.GetID(),
51 )
52
53 return err
54 }
55
56 var secrets model.Secrets
57 if err := clienv.UnmarshalFile(ce.Path.Secrets(), &secrets, env.Unmarshal); err != nil {
58 return fmt.Errorf(
59 "failed to parse secrets, make sure secret values are between quotes: %w",
60 err,
61 )
62 }
63
64 ce.Infoln("Verifying configuration...")
65
66 if _, err := Validate(ce, "local", secrets); err != nil {
67 return err
68 }
69
70 ce.Infoln("Configuration is valid!")
71
72 return nil
73}
74
75func ApplyJSONPatches[T any](
76 cfg T,

Callers

nothing calls this directly

Calls 11

FromCLIFunction · 0.92
UnmarshalFileFunction · 0.92
ValidateRemoteFunction · 0.85
GetAppInfoMethod · 0.80
ErrorfMethod · 0.80
GetSubdomainMethod · 0.80
SecretsMethod · 0.80
InfolnMethod · 0.80
ValidateFunction · 0.70
StringMethod · 0.45
GetIDMethod · 0.45

Tested by

no test coverage detected