Skip to content

Expose resolved project configuration as JSON - #165

Merged
peterjaap merged 2 commits into
mainfrom
copilot/read-project-config-as-json
Nov 16, 2026
Merged

peterjaap merged 2 commits into
mainfrom
copilot/read-project-config-as-json

Conversation

@peterjaap

@peterjaap peterjaap commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Integrations currently need to parse project YAML and reproduce MageBox’s merge and service-resolution rules to obtain connection details.

  • JSON output: Add magebox config --json with the merged project configuration and derived database, cache, search, and domain values.
  • Machine-readable behavior: Keep stdout JSON-only and return an error when the project configuration cannot be loaded.
  • Documentation: Describe the output, including its potential to contain sensitive configuration values.
magebox config --json | jq '.derived.database'

Copilot AI linked an issue Nov 16, 2026 that may be closed by this pull request
@peterjaap peterjaap changed the title [WIP] Add command to print project config as JSON Expose resolved project configuration as JSON Nov 16, 2026
@peterjaap
peterjaap marked this pull request as ready for review November 16, 2026 20:03
@peterjaap
peterjaap requested a balanced review from Copilot November 16, 2026 20:04
@github-actions

Copy link
Copy Markdown
Contributor

📦 PR build artifacts

Built from 3f4dcf8 — view run. Artifacts expire in 14 days.

Note: artifact download links require being signed in to GitHub with access to this repository.

@peterjaap
peterjaap merged commit 9ae0f87 into main Nov 16, 2026
13 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The derived search version can report a project's requested version instead of the shared container's resolved version, misleading integrations unless both search branches use the provisioning resolver.

1 open issue
What changed in this PR

Adds magebox config --json so integrations can read merged project settings and derived connection details without parsing YAML themselves, addressing the JSON-output portion of #164.

Changes:

  • Adds JSON output containing merged configuration, service endpoints, and domain details.
  • Bypasses startup and update messages for machine-readable output.
  • Adds tests and documentation covering overrides, includes, missing configuration, and sensitive values.
File Description
vitepress/​reference/​commands.md Documents JSON output, endpoint caveats, and sensitive values.
cmd/​magebox/​root.go Skips pre/post-run messages for JSON mode.
cmd/​magebox/​config_project.go Loads merged configuration and serializes derived values.
cmd/​magebox/​config_project_test.go Tests merged settings, endpoints, domains, and missing configuration.
cmd/​magebox/​config_cmd.go Registers the JSON flag and project configuration handler.

Review effort: Balanced

Comment on lines +84 to +86
result.Derived.Search = &projectEndpoint{Service: "opensearch", Version: cfg.Services.OpenSearch.Version, Host: "127.0.0.1", Port: docker.GetOpenSearchPort()}
} else if cfg.Services.HasElasticsearch() {
result.Derived.Search = &projectEndpoint{Service: "elasticsearch", Version: cfg.Services.Elasticsearch.Version, Host: "127.0.0.1", Port: docker.GetElasticsearchPort()}
@GrimLink

Copy link
Copy Markdown

Wow thats fast, thanks @peterjaap 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Read the project config as JSON

4 participants