Skip to content

Conversation

@sam-shift72
Copy link
Contributor

Lets you override API config and toggle values when running a template render / dev server to help with testing.

kibble render --watch --port 8081 --config foo=123 --config bar=456  --toggle test=true

You can also specify these in kibble.json

{
  "configOverrides": {
    "foo": "bar"
  },
  "toggleOverrides": {
    "test": true
  }
}

Command line args > kibble.json > api

Obviously, this only affects the site template, and any configs/toggles that might get passed through to the frontend JS!

The command line args are only supported on the render command, however the kibble.json settings should affect all places in the code that render the site. If you deployed a site with kibble.json overrides, those overrides would be applied to the built site too!

You can also do this via kibble.json as a side effect of how this is
implemented.

This is primarily intended for testing template features locally -- it's
all just stuff you could do by modifying your jets
@sam-shift72 sam-shift72 requested a review from l0ud0gg July 8, 2025 03:27
@sam-shift72 sam-shift72 requested a review from Kazetsukai July 8, 2025 22:57
@sam-shift72
Copy link
Contributor Author

Re: overrides in kibble.json, I could possibly take out the json serialization tags so that these could only be set via command line.

I had to tap into the Kibble config as it's the way the app passes stuff around, and I figured it might be useful to be able to put local settings into your kibble.json rather than modifying application.jet or whatever directly.

I don't think it's desirable to deploy site templates with these overrides (seeing as we could set them via the APIs) but probably harmless?

@Kazetsukai Kazetsukai requested a review from Copilot July 9, 2025 03:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for overriding API configuration values and feature toggles via command-line flags (--config, --toggle) and kibble.json (configOverrides, toggleOverrides), and merges those overrides into both the CLI render command and the API-loading functions.

  • Introduce ConfigOverrides and ToggleOverrides in the models.Config struct.
  • Initialize override maps in default config loading and in kibble.json.
  • Add --config and --toggle flags to the render command and merge overrides in both CLI and API paths.

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
kibble/models/config.go Added ConfigOverrides and ToggleOverrides fields to the model
kibble/go.mod Bumped github.com/spf13/pflag to v1.0.6
kibble/config/config.go Initialized override maps in default LoadConfig
kibble/cmd/render.go Defined CLI flags, parsed and applied config/toggle overrides
kibble/api/config.go Merged override maps into API-loaded configs and feature toggles
Comments suppressed due to low confidence (1)

kibble/models/config.go:40

  • Add a comment for the ToggleOverrides field (e.g., // allows overriding feature toggles) to match the style used for ConfigOverrides.
	ToggleOverrides map[string]bool   `json:"toggleOverrides"`

Copy link
Contributor

@l0ud0gg l0ud0gg left a comment

Choose a reason for hiding this comment

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

not tested directly but looks good to me. super useful espec for testing new features / site upgrades locally.

@sam-shift72 sam-shift72 merged commit 5e06dd2 into master Jul 9, 2025
2 checks passed
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.

3 participants