Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

fix: use resolved object when constructing cloud configuration#974

Merged
dbarrosop merged 1 commit into
mainfrom
fill-cloud-cfg
Jul 2, 2025
Merged

fix: use resolved object when constructing cloud configuration#974
dbarrosop merged 1 commit into
mainfrom
fill-cloud-cfg

Conversation

@dbarrosop
Copy link
Copy Markdown
Member

@dbarrosop dbarrosop commented Jul 2, 2025

PR Type

Bug fix


Description

  • Fixes use of resolved config object in cloud setup functions

  • Ensures secrets-resolved config is used for version checks and compose file

  • Updates ValidateRemote to apply JSON patches before secrets resolution

  • Improves documentation for ValidateRemote function


Changes diagram

flowchart LR
  A["ValidateRemote applies JSON patches first"]
  B["SecretsResolver called with patched config"]
  C["cloud() uses cfgSecrets for checks and compose"]
  D["Improved ValidateRemote documentation"]

  A -- "patched config" --> B
  B -- "returns cfgSecrets" --> C
  B -- "returns cfgSecrets" --> D
Loading

Changes walkthrough 📝

Relevant files
Bug fix
validate.go
Refactor and document ValidateRemote, fix patch/secrets order

cmd/config/validate.go

  • Calls SecretsResolver without type parameter for consistency
  • Applies JSON patches before secrets resolution in ValidateRemote
  • Adds detailed documentation for ValidateRemote
  • Removes duplicate JSON patch application logic
  • +16/-10 
    cloud.go
    Use secrets-resolved config for cloud environment setup   

    cmd/dev/cloud.go

  • Uses secrets-resolved config (cfgSecrets) for version checks
  • Passes cfgSecrets to compose file and Hasura wrapper
  • Ensures cloud setup uses fully resolved configuration
  • +3/-3     

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @github-actions
    Copy link
    Copy Markdown
    Contributor

    github-actions Bot commented Jul 2, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Patch Application Order

    The PR changes the order of JSON patch application and secrets resolution in ValidateRemote. The reviewer should ensure that this new order is correct and does not introduce subtle bugs, especially regarding the expected state of the config at each step.

    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)
    	}
    }
    Use of Resolved Config

    The code now consistently uses the secrets-resolved config (cfgSecrets) for version checks and compose file generation. The reviewer should verify that all downstream consumers expect secrets-resolved values and that this change does not break any assumptions.

    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(
    	cfgSecrets,
    	ce.LocalSubdomain(),

    @github-actions
    Copy link
    Copy Markdown
    Contributor

    github-actions Bot commented Jul 2, 2025

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    @dbarrosop dbarrosop merged commit b148d0a into main Jul 2, 2025
    10 checks passed
    @dbarrosop dbarrosop deleted the fill-cloud-cfg branch July 2, 2025 07:35
    Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    2 participants