Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:1broseidon Ketch configbase Setting

From Leeroopedia
Knowledge Sources
Domains Configuration, Provider_Registry
Last Updated 2026-10-27 00:00 GMT

Overview

The descriptor for one operator-configured provider value and its wire contract: a secret key with an optional rotation pool, or a non-secret scalar such as an instance URL.

Description

A Setting on a provider descriptor declares a config field and its behavior. KeyPool declares a secret API key and its rotation pool (`Secret:true, GateDoctor:true`) — it both gates doctor and promotes the provider in the auto chain. Scalar declares a single non-secret value (e.g. an instance URL). Both helpers default `FileOrder`/`DiscoveryOrder`/`EnvOrder`/`ValidationOrder` to 1000, so new settings append after legacy ordered ones. `Configured` reports explicit credentials that make a health check required. `Set` validates one `config set` value.

Usage

Used when adding a new search/code/docs provider (see the provider registry pattern). Declared on the `Provider.Settings` slice; the shared config layer reads them for discovery, doctor gating, and `*_set` boolean emission without exposing secrets.

Code Reference

Source Location

  • Repository: ketch
  • File: internal/configbase/settings.go

Signature

type Setting struct {
	Key             string
	Plural          string
	Secret          bool
	Token           bool
	ManualEnv       bool
	GateDoctor      bool
	Always          bool
	Default         string
	FileOrder       int
	DiscoveryOrder  int
	EnvOrder        int
	ValidationOrder int
	Resolve         func(*Config) (string, string)
	Display         func(*Config) string
}

// KeyPool declares a secret key and its rotation pool.
func KeyPool(key, plural string, positions ...int) Setting

// Scalar declares a single non-secret operator value (e.g. an instance URL).
func Scalar(key string) Setting

// Configured reports explicit credentials that make a health check required.
func (s Setting) Configured(c *Config) bool

// Set validates one config-set value, returning whether this setting owns key.
func (s Setting) Set(c *Config, key, value string) (bool, error)

Import

import config "github.com/1broseidon/ketch/internal/configbase"

I/O Contract

Outputs (KeyPool)

Name Type Description
return Setting Secret:true, GateDoctor:true, default orderings 1000

Outputs (Scalar)

Name Type Description
return Setting Non-secret; default orderings 1000

Usage Examples

Declaring a Keyed Provider's Settings

func braveProvider() search.Provider {
	return search.Provider{
		ID:       "brave",
		Settings: []config.Setting{
			config.KeyPool("brave_api_key", "brave_api_keys"),
		},
		// …
	}
}

Declaring an Instance URL

Settings: []config.Setting{
	config.Scalar("searxng_url"),
},

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment