Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions cmd/config/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,19 @@ func Validate(
return nil, fmt.Errorf("failed to create schema: %w", err)
}

cfg, err = appconfig.SecretsResolver[model.ConfigConfig](cfg, secrets, schema.Fill)
cfg, err = appconfig.SecretsResolver(cfg, secrets, schema.Fill)
if err != nil {
return nil, fmt.Errorf("failed to validate config: %w", err)
}

return cfg, nil
}

// ValidateRemote validates the configuration of a remote project by fetching
// the secrets and applying them to the configuration. It also applies any
// JSON patches from the overlay directory if it exists.
// It returns the original configuration with the applied patches (without being filled
// and without secrets resolved) and another configuration filled and with secrets resolved.
func ValidateRemote(
ctx context.Context,
ce *clienv.CliEnv,
Expand All @@ -148,6 +153,14 @@ func ValidateRemote(
return nil, nil, fmt.Errorf("failed to parse config: %w", err)
}

if clienv.PathExists(ce.Path.Overlay(subdomain)) {
var err error
cfg, err = ApplyJSONPatches(*cfg, ce.Path.Overlay(subdomain))
if err != nil {
return nil, nil, fmt.Errorf("failed to apply json patches: %w", err)
}
}

schema, err := schema.New()
if err != nil {
return nil, nil, fmt.Errorf("failed to create schema: %w", err)
Expand All @@ -166,16 +179,9 @@ func ValidateRemote(
return nil, nil, fmt.Errorf("failed to get secrets: %w", err)
}

if clienv.PathExists(ce.Path.Overlay(subdomain)) {
var err error
cfg, err = ApplyJSONPatches(*cfg, ce.Path.Overlay(subdomain))
if err != nil {
return nil, nil, fmt.Errorf("failed to apply json patches: %w", err)
}
}

secrets := respToSecrets(secretsResp.GetAppSecrets(), false)
cfgSecrets, err := appconfig.SecretsResolver[model.ConfigConfig](cfg, secrets, schema.Fill)

cfgSecrets, err := appconfig.SecretsResolver(cfg, secrets, schema.Fill)
if err != nil {
return nil, nil, fmt.Errorf("failed to validate config: %w", err)
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/dev/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@ func cloud( //nolint:funlen
ctxWithTimeout, cancel := context.WithTimeout(ctx, 5*time.Second) //nolint:mnd
defer cancel()
ce.Infoln("Checking versions...")
if err := software.CheckVersions(ctxWithTimeout, ce, cfg, appVersion); err != nil {
if err := software.CheckVersions(ctxWithTimeout, ce, cfgSecrets, appVersion); err != nil {
ce.Warnln("Problem verifying recommended versions: %s", err.Error())
}

ce.Infoln("Setting up Nhost development environment...")
composeFile, err := dockercompose.CloudComposeFileFromConfig(
cfg,
cfgSecrets,
ce.LocalSubdomain(),
proj.GetSubdomain(),
proj.GetRegion().GetName(),
Expand Down Expand Up @@ -231,7 +231,7 @@ func cloud( //nolint:funlen
ctx,
ce.LocalSubdomain(),
ce.Path.NhostFolder(),
*cfg.Hasura.Version,
*cfgSecrets.Hasura.Version,
"metadata", "export",
"--skip-update-check",
"--log-level", "ERROR",
Expand Down
Loading