Skip to content

feat: config files#5045

Merged
chronark merged 37 commits intomainfrom
chronark/config-package
Feb 18, 2026
Merged

feat: config files#5045
chronark merged 37 commits intomainfrom
chronark/config-package

Conversation

@chronark
Copy link
Collaborator

@chronark chronark commented Feb 16, 2026

Summary

This PR looks large, but the main change is in pkg/config. The rest is just about applying those changes to each service.

Introduces pkg/config, a new configuration package that replaces environment-variable-based configuration with file-based config (TOML, YAML, JSON).

What this does

  • Struct-tag-driven validation: config:"required,default=8080,min=1,max=65535"
  • Environment variable expansion: ${VAR} in config files
  • Validator interface: Custom cross-field validation via Validate() method
  • Collects all errors: Reports every validation failure at once instead of failing fast

For dev/k8s/manifests I found a very neat way to configure them via ConfigMap, but for docker-compose it's not as great, cause it requries an extra file. but we were talking about getting rid of compose anyways

This passes all tests and you can develop with it locally

chronark and others added 8 commits February 12, 2026 10:40
only show build logs until it's built, then show domains and network
Introduces a new configuration package that replaces environment variable
based configuration with file-based config. Features:

- Load and validate config from TOML, YAML, or JSON files
- Struct tag driven: required, default, min/max, oneof, nonempty
- Environment variable expansion (${VAR} and ${VAR:-default})
- JSON Schema generation for editor autocompletion
- Collects all validation errors instead of failing on first
- Custom Validator interface for cross-field checks

Also adds cmd/generate-config-docs for generating MDX documentation
from Go struct tags, and a Makefile target 'config-docs'.

Amp-Thread-ID: https://ampcode.com/threads/T-019c672a-0e8e-7138-b0ab-27cdbeaca7ba
Co-authored-by: Amp <amp@ampcode.com>
@vercel
Copy link

vercel bot commented Feb 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dashboard Ready Ready Preview, Comment Feb 18, 2026 4:50pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
engineering Ignored Ignored Preview Feb 18, 2026 4:50pm

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 16, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Centralizes runtime configuration into TOML files and a new pkg/config loader. Replaces many CLI flags and environment-variable wiring with file-based loading, adds typed/tagged config structs and validation, updates service startup to load configs and inject runtime fields, and adjusts builds, tests, dev manifests, and Vault master-key model.

Changes

Cohort / File(s) Summary
Config package
pkg/config/BUILD.bazel, pkg/config/common.go, pkg/config/config.go, pkg/config/config_test.go, pkg/config/doc.go, pkg/config/tags.go
New package providing generic Load[T]/LoadBytes, environment expansion, TOML unmarshalling, tag-driven defaults/validation, Validator interface, tests and docs.
Entrypoints & CLI
cmd/api/main.go, cmd/ctrl/api.go, cmd/ctrl/worker.go, cmd/frontline/main.go, cmd/krane/main.go, cmd/preflight/main.go, cmd/sentinel/main.go, cmd/vault/main.go, cmd/*/BUILD.bazel
Replaces per-flag CLIs with --config/--config-data; actions call config.Load[...], set runtime fields (e.g., Clock, IDs), and delegate to service Run. BUILD files updated to depend on //pkg/config.
Service config types
svc/*/config.go, e.g. svc/api/config.go, svc/ctrl/api/config.go, svc/ctrl/worker/config.go, svc/frontline/config.go, svc/krane/config.go, svc/preflight/config.go, svc/sentinel/config.go, svc/vault/config.go
Major restructure: nested, TOML-tagged config structs (Observability, Database, Vault, Gossip, ClickHouse, Control, TLSFiles, etc.), pointer-receiver Validate() methods, runtime-only fields, and many field renames/relocations.
Runtime wiring
svc/*/run.go, svc/*/*_test.go, svc/api/*, svc/ctrl/*, svc/krane/*, svc/frontline/*, svc/preflight/*, svc/sentinel/*, svc/vault/*
Updated runtime code and tests to use new nested config paths, nil-checks for optional subsystems, new validation/defaulting behavior, and to obtain runtime fields (Clock, IDs) after loading.
Vault master-key model
svc/vault/internal/*, svc/vault/integration/*, svc/vault/testutil/*
Replaces MasterKeys []string with MasterKey string and optional PreviousMasterKey *string; updates parsing, load logic, service internals, and tests accordingly.
Krane sentinel embedding
svc/krane/internal/sentinel/apply.go, svc/krane/internal/sentinel/BUILD.bazel
Embed configs into sentinel containers as a TOML blob via UNKEY_CONFIG_DATA instead of many UNKEY_* env vars; adds toml dependency and //pkg/config to build.
Build / dependency updates
MODULE.bazel, go.mod, pkg/*/BUILD.bazel, svc/*/BUILD.bazel, cmd/*/BUILD.bazel, svc/krane/internal/sentinel/BUILD.bazel
Adds BurntSushi/toml and gopkg.in/yaml.v3, introduces //pkg/config to many targets, removes several legacy deps (uid/tls/assert) where replaced by config usage.
Dev orchestration & manifests
dev/config/*.toml, dev/docker-compose.yaml, dev/k8s/manifests/*.yaml
Adds per-service TOML dev configs, converts compose/k8s to mount/pass --config and ConfigMaps instead of many env vars; updates Deployments/Services to mount /etc/unkey/unkey.toml.
Docs & examples
pkg/config/doc.go, web/.../config.mdx, svc/*/doc.go
Adds package docs for config, updates service docs and examples to show TOML-based config.Load usage and property-style config reference.
Tests & harnesses
svc/api/*_test.go, svc/*/integration/*, svc/*/harness.go
Tests and harnesses updated to construct/use new nested config types (Database, Observability, ClickHouse, TLS, Control, etc.) and to load/validate via pkg/config where applicable.

Sequence Diagram(s)

sequenceDiagram
participant CLI as Entrypoint (binary)
participant FS as Config file / ConfigMap
participant Loader as pkg/config.Load[T]
participant Service as Service.Run(ctx, cfg)
participant Runtime as Runtime deps (Clock, uid)

CLI->>FS: read/unmount /etc/unkey/unkey.toml (or --config-data)
CLI->>Loader: call Load[T](path or bytes)
Loader->>FS: read bytes / expand env vars
Loader->>Loader: TOML unmarshal, apply defaults, validate
Loader-->>CLI: return typed cfg (T)
CLI->>Runtime: inject runtime fields (Clock, InstanceID, FrontlineID)
CLI->>Service: call Run(ctx, cfg)
Service->>Service: initialize subsystems using cfg (Vault, DB, Observability, Gossip)
Service-->>CLI: start server / listen
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description provides a comprehensive summary of the changes, explaining the main feature (pkg/config), key capabilities (validation, env expansion, Validator interface), and scope. However, it does not follow the required template structure with sections like 'Type of change', 'How should this be tested', or the checklist. Fill out all required template sections including 'Type of change', 'How should this be tested', and complete the checklist items to meet repository standards.
Docstring Coverage ⚠️ Warning Docstring coverage is 38.10% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: config files' is clear and concise, accurately summarizing the main feature addition (config file system) in this large changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chronark/config-package

Comment @coderabbitai help to get the list of available commands and usage tips.

@vercel vercel bot temporarily deployed to Preview – dashboard February 16, 2026 16:21 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard February 16, 2026 18:55 Inactive
* feat(api): migrate API service to file-based config

Migrate the API service from environment variables to TOML file-based
configuration using pkg/config. Replaces all UNKEY_* env vars with a
structured api.toml config file.

Changes:
- Rewrite svc/api/config.go with tagged Config struct
- Update svc/api/run.go to use new config fields
- Update cmd/api/main.go to accept --config flag
- Add dev/config/api.toml for docker-compose
- Update dev/k8s/manifests/api.yaml with ConfigMap
- Regenerate config docs from struct tags

Amp-Thread-ID: https://ampcode.com/threads/T-019c672a-0e8e-7138-b0ab-27cdbeaca7ba
Co-authored-by: Amp <amp@ampcode.com>

* feat(vault): migrate Vault service to file-based TOML config (#5047)

* feat(vault): migrate Vault service to file-based config

Migrate the Vault service from environment variables to TOML file-based
configuration using pkg/config.

Changes:
- Rewrite svc/vault/config.go with tagged Config struct
- Update svc/vault/run.go to use new config fields
- Update cmd/vault/main.go to accept --config flag
- Add dev/config/vault.toml for docker-compose
- Update dev/k8s/manifests/vault.yaml with ConfigMap
- Remove UNKEY_* env vars from docker-compose and k8s

Amp-Thread-ID: https://ampcode.com/threads/T-019c672a-0e8e-7138-b0ab-27cdbeaca7ba
Co-authored-by: Amp <amp@ampcode.com>

* feat(ctrl): migrate Ctrl API and Worker to file-based TOML config (#5048)

* feat(ctrl): migrate Ctrl API and Worker services to file-based config

Migrate both ctrl-api and ctrl-worker from environment variables to TOML
file-based configuration using pkg/config.

Changes:
- Rewrite svc/ctrl/api/config.go and svc/ctrl/worker/config.go
- Update run.go files to use new config fields
- Update cmd/ctrl/api.go and worker.go to accept --config flag
- Add dev/config/ctrl-api.toml and ctrl-worker.toml
- Update dev/k8s/manifests/ctrl-api.yaml and ctrl-worker.yaml with ConfigMaps
- Remove UNKEY_* env vars from docker-compose and k8s manifests

* feat(krane): migrate Krane service to file-based TOML config (#5049)

* feat(krane): migrate Krane service to file-based config

Migrate the Krane container orchestrator from environment variables to
TOML file-based configuration using pkg/config.

Changes:
- Rewrite svc/krane/config.go with tagged Config struct
- Update svc/krane/run.go to use new config fields
- Update cmd/krane/main.go to accept --config flag
- Add dev/config/krane.toml for docker-compose
- Update dev/k8s/manifests/krane.yaml with ConfigMap
- Remove UNKEY_* env vars from docker-compose and k8s

Amp-Thread-ID: https://ampcode.com/threads/T-019c672a-0e8e-7138-b0ab-27cdbeaca7ba
Co-authored-by: Amp <amp@ampcode.com>

* feat(frontline): migrate Frontline service to file-based TOML config (#5050)

* feat(frontline): migrate Frontline service to file-based config

Migrate the Frontline reverse proxy from environment variables to TOML
file-based configuration using pkg/config.

Changes:
- Rewrite svc/frontline/config.go with tagged Config struct
- Update svc/frontline/run.go to use new config fields
- Update cmd/frontline/main.go to accept --config flag
- Update dev/k8s/manifests/frontline.yaml with ConfigMap
- Remove UNKEY_* env vars from k8s manifest

Amp-Thread-ID: https://ampcode.com/threads/T-019c672a-0e8e-7138-b0ab-27cdbeaca7ba
Co-authored-by: Amp <amp@ampcode.com>

* feat(preflight): migrate Preflight service to file-based TOML config (#5051)

* feat(preflight): migrate Preflight service to file-based config

Migrate the Preflight webhook admission controller from environment
variables to TOML file-based configuration using pkg/config.

Changes:
- Rewrite svc/preflight/config.go with tagged Config struct
- Update svc/preflight/run.go to use new config fields
- Update cmd/preflight/main.go to accept --config flag
- Update dev/k8s/manifests/preflight.yaml with ConfigMap
- Remove UNKEY_* env vars from k8s manifest

Amp-Thread-ID: https://ampcode.com/threads/T-019c672a-0e8e-7138-b0ab-27cdbeaca7ba
Co-authored-by: Amp <amp@ampcode.com>

* feat(sentinel): migrate Sentinel service to file-based config (#5052)

Migrate the Sentinel sidecar from environment variables to TOML
file-based configuration using pkg/config. This is the final service
migration in the config stack.

Changes:
- Rewrite svc/sentinel/config.go with tagged Config struct
- Update svc/sentinel/run.go to use new config fields
- Update cmd/sentinel/main.go to accept --config flag
- Update dev/docker-compose.yaml: replace env vars with TOML volume
  mounts for all migrated services (api, vault, krane, ctrl-api,
  ctrl-worker)
- Minor formatting fix in pkg/db generated code

---------

Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>
@chronark chronark changed the title feat: add pkg/config — struct-tag-driven configuration package feat: config files Feb 16, 2026
@vercel vercel bot temporarily deployed to Preview – engineering February 16, 2026 19:00 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard February 16, 2026 19:00 Inactive
@vercel vercel bot temporarily deployed to Preview – engineering February 17, 2026 07:18 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard February 17, 2026 07:19 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard February 17, 2026 19:01 Inactive
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
svc/ctrl/worker/run.go (1)

125-174: ⚠️ Potential issue | 🔴 Critical

Guard nil cfg.GitHub before deref.
Nil allowed above; later deref panics.

🔧 Minimal fix
 var ghClient githubclient.GitHubClient = githubclient.NewNoop()
+allowUnauth := false
 if cfg.GitHub != nil {
 	client, ghErr := githubclient.NewClient(githubclient.ClientConfig{
 		AppID:         cfg.GitHub.AppID,
 		PrivateKeyPEM: cfg.GitHub.PrivateKeyPEM,
 		WebhookSecret: "",
 	})
 	if ghErr != nil {
 		return fmt.Errorf("failed to create GitHub client: %w", ghErr)
 	}
 	ghClient = client
 	logger.Info("GitHub client initialized")
+	allowUnauth = cfg.GitHub.AllowUnauthenticatedDeployments
 } else {
 	logger.Info("GitHub client disabled (credentials not configured)")
 }
@@
-		AllowUnauthenticatedDeployments: cfg.GitHub.AllowUnauthenticatedDeployments,
+		AllowUnauthenticatedDeployments: allowUnauth,
 	}),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@svc/ctrl/worker/run.go` around lines 125 - 174, The code dereferences
cfg.GitHub.AllowUnauthenticatedDeployments without guarding for nil (cfg.GitHub
can be nil earlier), causing a panic; fix by computing a safe boolean (e.g.
allowUnauthenticated := false; if cfg.GitHub != nil { allowUnauthenticated =
cfg.GitHub.AllowUnauthenticatedDeployments }) and pass that into
deploy.Config.AllowUnauthenticatedDeployments instead of directly using
cfg.GitHub.AllowUnauthenticatedDeployments; update the call site around
hydrav1.NewDeployServiceServer -> deploy.New -> deploy.Config to use this
guarded value.
svc/api/cancel_test.go (2)

19-21: ⚠️ Potential issue | 🟡 Minor

Wrap scenario in t.Run.
As per coding guidelines, **/*_test.go: Organize tests using t.Run() for scenarios.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@svc/api/cancel_test.go` around lines 19 - 21, The TestContextCancellation
test should be converted to use a subtest via t.Run: wrap the existing test
logic inside a t.Run("context cancellation" or similar) closure so the scenario
is executed as a named subtest; update the TestContextCancellation function to
call t.Run and move the current test body into the provided func(t *testing.T)
block, keeping assertions and setup unchanged.

11-17: ⚠️ Potential issue | 🟠 Major

Set Clock in test config.
Nil clock risks panic if Run expects Clock set.

🩹 Minimal fix
 	"github.com/stretchr/testify/require"
+	"github.com/unkeyed/unkey/pkg/clock"
 	sharedconfig "github.com/unkeyed/unkey/pkg/config"
@@
-		Clock:      nil, // Will use real clock
+		Clock:      clock.New(),

Also applies to: 40-41

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@svc/api/cancel_test.go` around lines 11 - 17, The test constructs a config
without a Clock which can cause a panic when api.Run (or other svc/api
functions) expects cfg.Clock; update the test setup in cancel_test.go to
initialize and assign a Clock on the config used by the test (e.g., create a
mock/real clock instance and set cfg.Clock or use the package helper like
config.WithClock if available) for both places in the file (around the current
import area usage and the later test at lines 40-41) so the Run call receives a
non-nil Clock.
svc/sentinel/run.go (1)

123-136: ⚠️ Potential issue | 🟡 Minor

Validate or zero WAN fields explicitly for sentinels.

Per architecture requirements, sentinels operate intra-region only and must not use WAN gossip. Lines 124 and 131 resolve and pass WANSeeds and WANPort to cluster.New() whenever gossip is enabled. While WAN activation requires bridge election and non-empty seeds, sentinel deployments should not accept these fields at all. Add validation to reject non-empty WANSeeds/WANPort in sentinel context, or explicitly zero them before passing to cluster.New().

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@svc/sentinel/run.go` around lines 123 - 136, The sentinel runpath is passing
WAN configuration into cluster.New (wanSeeds, cfg.Gossip.WANPort) even though
sentinels must not use WAN gossip; update the logic around lanSeeds/wanSeeds and
the cluster.New(...) call in run.go to either (1) validate and return an error
if cfg.Gossip.WANSeeds is non-empty or cfg.Gossip.WANPort is set when running as
a sentinel (e.g., using cfg.SentinelID/Region to detect sentinel mode), or (2)
explicitly zero out WAN fields before calling cluster.New (set WANSeeds to
nil/empty and WANBindPort/WANPort to 0) so WAN is disabled for sentinels; adjust
the creation call to pass the sanitized/validated WANSeeds and WANBindPort and
ensure any error path reports the invalid config rather than allowing WAN gossip
to be used.
🧹 Nitpick comments (1)
svc/sentinel/config.go (1)

61-79: Redundant region validation in Validate() method.

The Region field already has config:"required,oneof=local.dev|us-east-1.aws|..." tag on line 42, which performs the same validation. The manual check in Validate() duplicates this logic and creates a maintenance burden if regions change.

Consider removing the manual validation:

♻️ Proposed simplification
 func (c *Config) Validate() error {
-	validRegions := []string{
-		"local.dev",
-		"us-east-1.aws",
-		"us-east-2.aws",
-		"us-west-1.aws",
-		"us-west-2.aws",
-		"eu-central-1.aws",
-	}
-
-	if !slices.Contains(validRegions, c.Region) {
-		return fmt.Errorf("invalid region: %s, must be one of %v", c.Region, validRegions)
-	}
-
 	return nil
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@svc/sentinel/config.go` around lines 61 - 79, The manual region check in
Config.Validate duplicates the struct tag validation on the Region field; remove
the redundant slices.Contains block from the Validate() method (the code that
defines validRegions and the if !slices.Contains(...) return) so that validation
relies on the existing config tag (oneof on Region), leaving Validate() to only
contain any truly cross-field checks or simply return nil; update or run tests
to ensure no other callers rely on the removed manual error message.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@svc/api/cancel_test.go`:
- Around line 11-13: The import block contains the same module imported twice
("github.com/unkeyed/unkey/pkg/config" and aliased as sharedconfig) causing a
build error; remove the duplicate so the package is imported only once and use a
single identifier consistently (either config or sharedconfig) throughout the
file (e.g., update references to config.New or sharedconfig.New accordingly),
and apply the same removal of duplicate imports in the other affected import
blocks around the same file (lines noted in review).

---

Outside diff comments:
In `@svc/api/cancel_test.go`:
- Around line 19-21: The TestContextCancellation test should be converted to use
a subtest via t.Run: wrap the existing test logic inside a t.Run("context
cancellation" or similar) closure so the scenario is executed as a named
subtest; update the TestContextCancellation function to call t.Run and move the
current test body into the provided func(t *testing.T) block, keeping assertions
and setup unchanged.
- Around line 11-17: The test constructs a config without a Clock which can
cause a panic when api.Run (or other svc/api functions) expects cfg.Clock;
update the test setup in cancel_test.go to initialize and assign a Clock on the
config used by the test (e.g., create a mock/real clock instance and set
cfg.Clock or use the package helper like config.WithClock if available) for both
places in the file (around the current import area usage and the later test at
lines 40-41) so the Run call receives a non-nil Clock.

In `@svc/ctrl/worker/run.go`:
- Around line 125-174: The code dereferences
cfg.GitHub.AllowUnauthenticatedDeployments without guarding for nil (cfg.GitHub
can be nil earlier), causing a panic; fix by computing a safe boolean (e.g.
allowUnauthenticated := false; if cfg.GitHub != nil { allowUnauthenticated =
cfg.GitHub.AllowUnauthenticatedDeployments }) and pass that into
deploy.Config.AllowUnauthenticatedDeployments instead of directly using
cfg.GitHub.AllowUnauthenticatedDeployments; update the call site around
hydrav1.NewDeployServiceServer -> deploy.New -> deploy.Config to use this
guarded value.

In `@svc/sentinel/run.go`:
- Around line 123-136: The sentinel runpath is passing WAN configuration into
cluster.New (wanSeeds, cfg.Gossip.WANPort) even though sentinels must not use
WAN gossip; update the logic around lanSeeds/wanSeeds and the cluster.New(...)
call in run.go to either (1) validate and return an error if cfg.Gossip.WANSeeds
is non-empty or cfg.Gossip.WANPort is set when running as a sentinel (e.g.,
using cfg.SentinelID/Region to detect sentinel mode), or (2) explicitly zero out
WAN fields before calling cluster.New (set WANSeeds to nil/empty and
WANBindPort/WANPort to 0) so WAN is disabled for sentinels; adjust the creation
call to pass the sanitized/validated WANSeeds and WANBindPort and ensure any
error path reports the invalid config rather than allowing WAN gossip to be
used.

---

Duplicate comments:
In `@dev/config/ctrl-worker.toml`:
- Around line 32-34: The ClickHouse admin credentials are hardcoded under the
[clickhouse] keys (url and admin_url); replace the embedded secret by loading
the admin connection string from an environment variable (e.g.,
CLICKHOUSE_ADMIN_URL) or use a non-secret dev placeholder and fetch the real
value in the configuration/loader code, update code paths that read admin_url to
prefer the env-provided value, and remove the plaintext password from the
committed toml so secrets are not stored in repo.

In `@pkg/config/config.go`:
- Around line 8-11: The BUILD for this package is missing the logger dependency
referenced in pkg/config/config.go (the import
"github.com/unkeyed/unkey/pkg/logger"); update the package's BUILD rule to add
the //pkg/logger target as a dependency so the import resolves during build,
ensuring any targets that depend on pkg/config include that dependency in their
deps.

---

Nitpick comments:
In `@svc/sentinel/config.go`:
- Around line 61-79: The manual region check in Config.Validate duplicates the
struct tag validation on the Region field; remove the redundant slices.Contains
block from the Validate() method (the code that defines validRegions and the if
!slices.Contains(...) return) so that validation relies on the existing config
tag (oneof on Region), leaving Validate() to only contain any truly cross-field
checks or simply return nil; update or run tests to ensure no other callers rely
on the removed manual error message.

@vercel vercel bot temporarily deployed to Preview – dashboard February 18, 2026 07:09 Inactive
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
svc/krane/run.go (1)

88-95: ⚠️ Potential issue | 🟠 Major

Duplicate r.Recover() and r.DeferCtx(shutdownGrafana) calls.

Both are registered twice, which will cause shutdownGrafana to be called twice during shutdown (potentially causing nil pointer dereference if it's nil) and unnecessary recover overhead.

Proposed fix
 	r := runner.New()
 	defer r.Recover()

 	r.DeferCtx(shutdownGrafana)

-	defer r.Recover()
-
-	r.DeferCtx(shutdownGrafana)
-
 	cluster := controlplane.NewClient(controlplane.ClientConfig{
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@svc/krane/run.go` around lines 88 - 95, The code registers r.Recover() and
r.DeferCtx(shutdownGrafana) twice; remove the duplicate calls so each is
registered exactly once. Keep a single defer r.Recover() immediately after
creating the runner via runner.New(), and keep one r.DeferCtx(shutdownGrafana)
(placed where cleanup registrations occur), deleting the repeated lines that
call r.Recover() and r.DeferCtx(shutdownGrafana) a second time.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@pkg/config/common.go`:
- Around line 14-18: The MetricsConfig struct's PrometheusPort field is missing
a TOML struct tag so it won't be populated from TOML files; update the
PrometheusPort field in MetricsConfig to include an appropriate toml tag (e.g.
toml:"prometheus_port") so the TOML decoder maps the key to PrometheusPort
(reference the MetricsConfig type and the PrometheusPort field when making the
change).

In `@svc/krane/run.go`:
- Around line 199-201: The log call in the anonymous goroutine (r.Go -> func(ctx
context.Context) error) passes a "tls" key with no value to logger.Info,
producing malformed structured logs; update the logger.Info invocation in that
function (the logger.Info call) to include a boolean or value for the "tls" key
(for example use tls != nil or a tlsEnabled variable or the actual tlsConfig) so
the key has a corresponding value alongside "addr".

In `@svc/vault/internal/vault/service.go`:
- Around line 105-116: The parseMasterKey function currently returns a
KeyEncryptionKey even if its identifier is empty, which can collapse map keys;
after proto.Unmarshal in parseMasterKey, validate the key ID (e.g., check kek.Id
or the appropriate identifier field on vaultv1.KeyEncryptionKey) and return an
error like "empty master key id" if it's empty, so callers never receive a
KeyEncryptionKey with a blank ID; update parseMasterKey to perform this check
and return a wrapped fmt.Errorf on failure.
- Around line 94-100: When adding the previous master key into decryptionKeys,
guard against duplicate IDs so we don't overwrite the current key: after parsing
with parseMasterKey and before assigning decryptionKeys[oldKek.GetId()] =
oldKek, check whether that id already exists in decryptionKeys (e.g., if _,
exists := decryptionKeys[oldKek.GetId()]; exists) and return an error indicating
a duplicate key ID instead of overwriting; reference parseMasterKey,
previousMasterKey, decryptionKeys and oldKek.GetId() in your change.

---

Outside diff comments:
In `@svc/krane/run.go`:
- Around line 88-95: The code registers r.Recover() and
r.DeferCtx(shutdownGrafana) twice; remove the duplicate calls so each is
registered exactly once. Keep a single defer r.Recover() immediately after
creating the runner via runner.New(), and keep one r.DeferCtx(shutdownGrafana)
(placed where cleanup registrations occur), deleting the repeated lines that
call r.Recover() and r.DeferCtx(shutdownGrafana) a second time.

---

Duplicate comments:
In `@pkg/config/common.go`:
- Around line 93-95: The TOML tag on the SecretKey field in pkg/config/common.go
validates base64 string length incorrectly (min=32 permits 24-byte
keys/AES-192); update the struct tag for SecretKey to require the 44-char base64
string produced by openssl rand -base64 32 (i.e. change min=32 to min=44) so the
SecretKey field enforces AES-256-length keys while leaving the rest of the tag
intact.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@vercel vercel bot temporarily deployed to Preview – dashboard February 18, 2026 07:52 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard February 18, 2026 08:25 Inactive
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@svc/vault/internal/vault/service.go`:
- Around line 103-114: In parseMasterKey, after proto.Unmarshal populates kek,
validate that the KeyEncryptionKey contains a non-empty key identifier (e.g.,
check kek.GetKeyId() or kek.KeyId) and return a descriptive error (e.g., "master
key missing key id") if it's empty; this ensures empty/invalid keys are rejected
before returning kek.
- Around line 92-98: The code blindly inserts oldKek into decryptionKeys using
oldKek.GetId(), which can overwrite an existing entry; update the block in the
function that handles previousMasterKey (around previousMasterKey,
parseMasterKey, oldKek.GetId(), decryptionKeys) to first check whether
decryptionKeys already contains that id and handle it (e.g., return an error
indicating a duplicate key ID or skip the insert) instead of unconditionally
assigning to decryptionKeys[oldKek.GetId()]; ensure the chosen behavior is
consistent with how other keys are added in this function.

@vercel vercel bot temporarily deployed to Preview – engineering February 18, 2026 09:27 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard February 18, 2026 09:28 Inactive
@vercel vercel bot temporarily deployed to Preview – engineering February 18, 2026 09:42 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard February 18, 2026 09:43 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard February 18, 2026 11:17 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard February 18, 2026 12:34 Inactive
@vercel vercel bot temporarily deployed to Preview – dashboard February 18, 2026 16:50 Inactive
@chronark chronark merged commit 75b537b into main Feb 18, 2026
15 checks passed
@chronark chronark deleted the chronark/config-package branch February 18, 2026 16:54
MichaelUnkey pushed a commit that referenced this pull request Feb 26, 2026
* fix: cleanup project side nav

* feat: simplify deployment overview page

only show build logs until it's built, then show domains and network

* feat: add pkg/config for struct-tag-driven TOML/YAML/JSON configuration

Introduces a new configuration package that replaces environment variable
based configuration with file-based config. Features:

- Load and validate config from TOML, YAML, or JSON files
- Struct tag driven: required, default, min/max, oneof, nonempty
- Environment variable expansion (${VAR} and ${VAR:-default})
- JSON Schema generation for editor autocompletion
- Collects all validation errors instead of failing on first
- Custom Validator interface for cross-field checks

Also adds cmd/generate-config-docs for generating MDX documentation
from Go struct tags, and a Makefile target 'config-docs'.

Amp-Thread-ID: https://ampcode.com/threads/T-019c672a-0e8e-7138-b0ab-27cdbeaca7ba
Co-authored-by: Amp <amp@ampcode.com>

* remove gen

* clean up

* feat(api): migrate API service to file-based TOML config (#5046)

* feat(api): migrate API service to file-based config

Migrate the API service from environment variables to TOML file-based
configuration using pkg/config. Replaces all UNKEY_* env vars with a
structured api.toml config file.

Changes:
- Rewrite svc/api/config.go with tagged Config struct
- Update svc/api/run.go to use new config fields
- Update cmd/api/main.go to accept --config flag
- Add dev/config/api.toml for docker-compose
- Update dev/k8s/manifests/api.yaml with ConfigMap
- Regenerate config docs from struct tags

Amp-Thread-ID: https://ampcode.com/threads/T-019c672a-0e8e-7138-b0ab-27cdbeaca7ba
Co-authored-by: Amp <amp@ampcode.com>

* feat(vault): migrate Vault service to file-based TOML config (#5047)

* feat(vault): migrate Vault service to file-based config

Migrate the Vault service from environment variables to TOML file-based
configuration using pkg/config.

Changes:
- Rewrite svc/vault/config.go with tagged Config struct
- Update svc/vault/run.go to use new config fields
- Update cmd/vault/main.go to accept --config flag
- Add dev/config/vault.toml for docker-compose
- Update dev/k8s/manifests/vault.yaml with ConfigMap
- Remove UNKEY_* env vars from docker-compose and k8s

Amp-Thread-ID: https://ampcode.com/threads/T-019c672a-0e8e-7138-b0ab-27cdbeaca7ba
Co-authored-by: Amp <amp@ampcode.com>

* feat(ctrl): migrate Ctrl API and Worker to file-based TOML config (#5048)

* feat(ctrl): migrate Ctrl API and Worker services to file-based config

Migrate both ctrl-api and ctrl-worker from environment variables to TOML
file-based configuration using pkg/config.

Changes:
- Rewrite svc/ctrl/api/config.go and svc/ctrl/worker/config.go
- Update run.go files to use new config fields
- Update cmd/ctrl/api.go and worker.go to accept --config flag
- Add dev/config/ctrl-api.toml and ctrl-worker.toml
- Update dev/k8s/manifests/ctrl-api.yaml and ctrl-worker.yaml with ConfigMaps
- Remove UNKEY_* env vars from docker-compose and k8s manifests

* feat(krane): migrate Krane service to file-based TOML config (#5049)

* feat(krane): migrate Krane service to file-based config

Migrate the Krane container orchestrator from environment variables to
TOML file-based configuration using pkg/config.

Changes:
- Rewrite svc/krane/config.go with tagged Config struct
- Update svc/krane/run.go to use new config fields
- Update cmd/krane/main.go to accept --config flag
- Add dev/config/krane.toml for docker-compose
- Update dev/k8s/manifests/krane.yaml with ConfigMap
- Remove UNKEY_* env vars from docker-compose and k8s

Amp-Thread-ID: https://ampcode.com/threads/T-019c672a-0e8e-7138-b0ab-27cdbeaca7ba
Co-authored-by: Amp <amp@ampcode.com>

* feat(frontline): migrate Frontline service to file-based TOML config (#5050)

* feat(frontline): migrate Frontline service to file-based config

Migrate the Frontline reverse proxy from environment variables to TOML
file-based configuration using pkg/config.

Changes:
- Rewrite svc/frontline/config.go with tagged Config struct
- Update svc/frontline/run.go to use new config fields
- Update cmd/frontline/main.go to accept --config flag
- Update dev/k8s/manifests/frontline.yaml with ConfigMap
- Remove UNKEY_* env vars from k8s manifest

Amp-Thread-ID: https://ampcode.com/threads/T-019c672a-0e8e-7138-b0ab-27cdbeaca7ba
Co-authored-by: Amp <amp@ampcode.com>

* feat(preflight): migrate Preflight service to file-based TOML config (#5051)

* feat(preflight): migrate Preflight service to file-based config

Migrate the Preflight webhook admission controller from environment
variables to TOML file-based configuration using pkg/config.

Changes:
- Rewrite svc/preflight/config.go with tagged Config struct
- Update svc/preflight/run.go to use new config fields
- Update cmd/preflight/main.go to accept --config flag
- Update dev/k8s/manifests/preflight.yaml with ConfigMap
- Remove UNKEY_* env vars from k8s manifest

Amp-Thread-ID: https://ampcode.com/threads/T-019c672a-0e8e-7138-b0ab-27cdbeaca7ba
Co-authored-by: Amp <amp@ampcode.com>

* feat(sentinel): migrate Sentinel service to file-based config (#5052)

Migrate the Sentinel sidecar from environment variables to TOML
file-based configuration using pkg/config. This is the final service
migration in the config stack.

Changes:
- Rewrite svc/sentinel/config.go with tagged Config struct
- Update svc/sentinel/run.go to use new config fields
- Update cmd/sentinel/main.go to accept --config flag
- Update dev/docker-compose.yaml: replace env vars with TOML volume
  mounts for all migrated services (api, vault, krane, ctrl-api,
  ctrl-worker)
- Minor formatting fix in pkg/db generated code

---------

Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>

* fix: bad config

* remove unnecessary tls config for ctrl api

* fix: error

* fix: do not log config content

* ix: remove kafka

* fix: replica

* fix: return err

* fix: only overwrite frontline id if missing

* fix: observability

* fix: otel

* fix: redundant config

* fix: reuse tls

* fix: consolidate

* fix: use shared configs

* fix: config

* fix: something

* Update pkg/config/common.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix: vault startup

* fix: instanceid

* fix: vault config

* fix: make configs required

* fix: everything works again

---------

Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Mar 17, 2026
* test keys table

* re org and exports

* error fix

* Apos

* chore: remove deployment breadcrumbs (#5019)

* fix: cleanup project side nav

* feat: simplify deployment overview page

only show build logs until it's built, then show domains and network

* chore: clean up nav

* fix(clickhouse): improve latest keys used queries for high volume (150M +)  (#4959)

* fix(clickhouse): improve clickhouse query for key logs and add  new table and mv for latest keys used

* fix valid/error count = 0 scenario

* remove identity_id from order by

* wrap identity_id with aggregating function since its removed from the order key

---------

Co-authored-by: Flo <53355483+Flo4604@users.noreply.github.com>

* fix: domain refetch and promotion disable rule (#5013)

* fix: domain refetch and promotion disable rule

* fix: regression

---------

Co-authored-by: Andreas Thomas <dev@chronark.com>

* refactor: move custom domains to tanstack db (#5017)

* refactor: move custom domains to tanstack db

* fix: comment

* fix: delete mutation

* remove: unnecessary query

* remove agent (#5021)

* remove agent

* remove agent

* chore: vault in dashboard (#5023)

* remove agent

* remove agent

* use vault in dashboard

* remove

* project domain (#5022)

* fix: cleanup project side nav

* feat: simplify deployment overview page

only show build logs until it's built, then show domains and network

* chore: clean up nav

* feat: add per-project sticky domain and only display that

* chore: use vault in api (#5024)

* chore: use vault in api

* chore: use vault in api

* fix harness

* use memory test

* vault container go start

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* fix: Make GH callback dynamic (#5029)

* dunno

* nextjs should allow a setting that says dynamic

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* allow longer timeouts (#5032)

* docs: add ratelimit.unkey.com benchmark links to ratelimiting docs

Add references to real-time performance benchmarks in:
- introduction.mdx: new 'Performance at scale' accordion
- modes.mdx: link after latency claim

Presents benchmarks as capability demonstration rather than comparison.

* docs: add description to cache store interface page (#5037)

Add missing SEO description to frontmatter

Generated-By: mintlify-agent

Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
Co-authored-by: Andreas Thomas <dev@chronark.com>

* docs: remove orphaned SDK documentation (#5033)

Remove Spring Boot Java, Rust, and Elixir SDK docs that are not linked in navigation and appear to be outdated/unmaintained.

Generated-By: mintlify-agent

Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
Co-authored-by: Andreas Thomas <dev@chronark.com>

* No data

* add bg

* rework release (#5044)

* rework release

* rework release

* feat: generate rpc wrappers (#5028)

* feat: generate rpc wrappers

* bazel happyier

* more changes

* more changes

* move path

* delete old files (#5043)

* fix: rabbit comments

---------

Co-authored-by: Oz <21091016+ogzhanolguncu@users.noreply.github.com>

* feat/gossip (#5015)

* add a gossip implementation

* add gossip to sentinel/frontline

* add message muxing

* sentinel fun

* cleansings

* cleansings

* cleansings

* cleansings

* use oneof

* fix bazel happiness

* do some changies

* exportoneof

* more cool fancy thingx

* change gateway choosing

* add label

* adjjust some more

* adjjust some more

* fixa test

* goodbye kafka

* fix: bazel

* rename gateway -> ambassador

* add docs

* fix: rabbit comments

* [autofix.ci] apply automated fixes

* idfk

* more changes

* more changes

* fix ordering

* fix missing files

* fix test

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* fix: retry hubble ui (#5056)

* fix: wait for cillium policy until CRDs are ready (#5059)

* fix: retry cillium policy until CRDs are ready

* fix: blocks until all system pods are ready

* deployment build screen v1 (#5042)

* fix: cleanup project side nav

* feat: simplify deployment overview page

only show build logs until it's built, then show domains and network

* feat: new build screen for ongoing deployments

* fix: table column typo

* fix: update copy to remove mention of analytics deletion (#5067)

* fix typo (#5039)

* rfc: sentinel middlewares (#5041)

* fix: cleanup project side nav

* feat: simplify deployment overview page

only show build logs until it's built, then show domains and network

* feat: middleware rfc

* Update svc/sentinel/proto/buf.gen.ts.yaml

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Flo <53355483+Flo4604@users.noreply.github.com>

* feat: config files (#5045)

* fix: cleanup project side nav

* feat: simplify deployment overview page

only show build logs until it's built, then show domains and network

* feat: add pkg/config for struct-tag-driven TOML/YAML/JSON configuration

Introduces a new configuration package that replaces environment variable
based configuration with file-based config. Features:

- Load and validate config from TOML, YAML, or JSON files
- Struct tag driven: required, default, min/max, oneof, nonempty
- Environment variable expansion (${VAR} and ${VAR:-default})
- JSON Schema generation for editor autocompletion
- Collects all validation errors instead of failing on first
- Custom Validator interface for cross-field checks

Also adds cmd/generate-config-docs for generating MDX documentation
from Go struct tags, and a Makefile target 'config-docs'.

Amp-Thread-ID: https://ampcode.com/threads/T-019c672a-0e8e-7138-b0ab-27cdbeaca7ba
Co-authored-by: Amp <amp@ampcode.com>

* remove gen

* clean up

* feat(api): migrate API service to file-based TOML config (#5046)

* feat(api): migrate API service to file-based config

Migrate the API service from environment variables to TOML file-based
configuration using pkg/config. Replaces all UNKEY_* env vars with a
structured api.toml config file.

Changes:
- Rewrite svc/api/config.go with tagged Config struct
- Update svc/api/run.go to use new config fields
- Update cmd/api/main.go to accept --config flag
- Add dev/config/api.toml for docker-compose
- Update dev/k8s/manifests/api.yaml with ConfigMap
- Regenerate config docs from struct tags

Amp-Thread-ID: https://ampcode.com/threads/T-019c672a-0e8e-7138-b0ab-27cdbeaca7ba
Co-authored-by: Amp <amp@ampcode.com>

* feat(vault): migrate Vault service to file-based TOML config (#5047)

* feat(vault): migrate Vault service to file-based config

Migrate the Vault service from environment variables to TOML file-based
configuration using pkg/config.

Changes:
- Rewrite svc/vault/config.go with tagged Config struct
- Update svc/vault/run.go to use new config fields
- Update cmd/vault/main.go to accept --config flag
- Add dev/config/vault.toml for docker-compose
- Update dev/k8s/manifests/vault.yaml with ConfigMap
- Remove UNKEY_* env vars from docker-compose and k8s

Amp-Thread-ID: https://ampcode.com/threads/T-019c672a-0e8e-7138-b0ab-27cdbeaca7ba
Co-authored-by: Amp <amp@ampcode.com>

* feat(ctrl): migrate Ctrl API and Worker to file-based TOML config (#5048)

* feat(ctrl): migrate Ctrl API and Worker services to file-based config

Migrate both ctrl-api and ctrl-worker from environment variables to TOML
file-based configuration using pkg/config.

Changes:
- Rewrite svc/ctrl/api/config.go and svc/ctrl/worker/config.go
- Update run.go files to use new config fields
- Update cmd/ctrl/api.go and worker.go to accept --config flag
- Add dev/config/ctrl-api.toml and ctrl-worker.toml
- Update dev/k8s/manifests/ctrl-api.yaml and ctrl-worker.yaml with ConfigMaps
- Remove UNKEY_* env vars from docker-compose and k8s manifests

* feat(krane): migrate Krane service to file-based TOML config (#5049)

* feat(krane): migrate Krane service to file-based config

Migrate the Krane container orchestrator from environment variables to
TOML file-based configuration using pkg/config.

Changes:
- Rewrite svc/krane/config.go with tagged Config struct
- Update svc/krane/run.go to use new config fields
- Update cmd/krane/main.go to accept --config flag
- Add dev/config/krane.toml for docker-compose
- Update dev/k8s/manifests/krane.yaml with ConfigMap
- Remove UNKEY_* env vars from docker-compose and k8s

Amp-Thread-ID: https://ampcode.com/threads/T-019c672a-0e8e-7138-b0ab-27cdbeaca7ba
Co-authored-by: Amp <amp@ampcode.com>

* feat(frontline): migrate Frontline service to file-based TOML config (#5050)

* feat(frontline): migrate Frontline service to file-based config

Migrate the Frontline reverse proxy from environment variables to TOML
file-based configuration using pkg/config.

Changes:
- Rewrite svc/frontline/config.go with tagged Config struct
- Update svc/frontline/run.go to use new config fields
- Update cmd/frontline/main.go to accept --config flag
- Update dev/k8s/manifests/frontline.yaml with ConfigMap
- Remove UNKEY_* env vars from k8s manifest

Amp-Thread-ID: https://ampcode.com/threads/T-019c672a-0e8e-7138-b0ab-27cdbeaca7ba
Co-authored-by: Amp <amp@ampcode.com>

* feat(preflight): migrate Preflight service to file-based TOML config (#5051)

* feat(preflight): migrate Preflight service to file-based config

Migrate the Preflight webhook admission controller from environment
variables to TOML file-based configuration using pkg/config.

Changes:
- Rewrite svc/preflight/config.go with tagged Config struct
- Update svc/preflight/run.go to use new config fields
- Update cmd/preflight/main.go to accept --config flag
- Update dev/k8s/manifests/preflight.yaml with ConfigMap
- Remove UNKEY_* env vars from k8s manifest

Amp-Thread-ID: https://ampcode.com/threads/T-019c672a-0e8e-7138-b0ab-27cdbeaca7ba
Co-authored-by: Amp <amp@ampcode.com>

* feat(sentinel): migrate Sentinel service to file-based config (#5052)

Migrate the Sentinel sidecar from environment variables to TOML
file-based configuration using pkg/config. This is the final service
migration in the config stack.

Changes:
- Rewrite svc/sentinel/config.go with tagged Config struct
- Update svc/sentinel/run.go to use new config fields
- Update cmd/sentinel/main.go to accept --config flag
- Update dev/docker-compose.yaml: replace env vars with TOML volume
  mounts for all migrated services (api, vault, krane, ctrl-api,
  ctrl-worker)
- Minor formatting fix in pkg/db generated code

---------

Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>

* fix: bad config

* remove unnecessary tls config for ctrl api

* fix: error

* fix: do not log config content

* ix: remove kafka

* fix: replica

* fix: return err

* fix: only overwrite frontline id if missing

* fix: observability

* fix: otel

* fix: redundant config

* fix: reuse tls

* fix: consolidate

* fix: use shared configs

* fix: config

* fix: something

* Update pkg/config/common.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix: vault startup

* fix: instanceid

* fix: vault config

* fix: make configs required

* fix: everything works again

---------

Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* clean deployment url label (#4976)

* clean deployment url

* fix conversion error and maintain single source of truth

---------

Co-authored-by: Andreas Thomas <dev@chronark.com>
Co-authored-by: Flo <53355483+Flo4604@users.noreply.github.com>

* feat: New deploy settings (#5073)

* feat: add github section

* feat: Add icons

* feat: add new sections

* feat: add settingsgroup

* feat: add region selection

* feat: add instances

* feat: add memory and cpu section

* feat: add sections

* feat: add health check

* feat: add scaling

* fix: get rid of redundant prop

* refactor: Add toasts to mutations

* refactor: rename component

* feat: add port section

* feat: fix overlapping borders

* refactor: fix healthcheck tRPC

* feat: add command section

* feat: add env section

* fix: finalize env-vars

* refactor: finalize

* feat: Add custom domains

* fix: overflwo

* feat: make tRPC route for each mutation

* fix: displayValue styles

* refactor: tidy

* fix: revert accidental changes

* feat: add cname table

* fix: github styling issues

* refactor: tidy

* refactor: rename

* fix: linter

* fix: dynamic form issue

* feat: allow env selection

* chore: tidy

* fix: use same chevron

* fix: use certmanager if availiable otherwise certfile (#5076)

* fix: use certmanager if availiable otherwise certfile

* feat: make tls enabled by default

now you need to explicitely pass tls.disabled=true
if not, we fail during startup.

also renamed some port vars to make it obvious what they are used for

* chore: log candidates for easier debugging

* fix: use static certs first

---------

Co-authored-by: chronark <dev@chronark.com>

* feat: sentinel key verification middleware (#5079)

* feat: key-sentinel-middleware

* fix error pages (#5083)

* fix error pages

* remove test

* move some files

* Update svc/frontline/internal/errorpage/error.go.tmpl

Co-authored-by: Andreas Thomas <dev@chronark.com>

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Andreas Thomas <dev@chronark.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* add rl headers.

* feat: new ui and fixed a bunch of stuff

* Update svc/sentinel/engine/match.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix: coderabbit

---------

Co-authored-by: Andreas Thomas <dev@chronark.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* clean up after sentinel middleware (#5088)

* feat: key-sentinel-middleware

* fix error pages (#5083)

* fix error pages

* remove test

* move some files

* Update svc/frontline/internal/errorpage/error.go.tmpl

Co-authored-by: Andreas Thomas <dev@chronark.com>

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Andreas Thomas <dev@chronark.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* add rl headers.

* feat: new ui and fixed a bunch of stuff

* Update svc/sentinel/engine/match.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix: coderabbit

* chore: clean up old columns

* fix: db

---------

Co-authored-by: Flo <flo@unkey.com>
Co-authored-by: Flo <53355483+Flo4604@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix proto type (#5093)

* fix: cleanup project side nav

* feat: simplify deployment overview page

only show build logs until it's built, then show domains and network

* fix: runtime exception due to gaslighting type

* fix: Modals with combo box work again  (#5002)

* chore: remove chproxy routes (#5101)

* chore: remove chproxy routes

* refactor: move prometheus metrics to scoped packages (#5102)

* remove the hand holding (#5108)

* feat: gossip metrics (#5107)

* fix: Make identity slugs copyable (#5100)

* fix: make me copy

* Update web/apps/dashboard/app/(app)/[workspaceSlug]/authorization/permissions/components/table/components/assigned-items-cell.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* refactor: useDeployment hook usage (#5086)

* refactor: useDeployment hook usage

* fix: remove redundant check

* feat: i need more metrics (#5115)

* docs: Python and Go examples (#5058)

* Add Python and Go SDK documentation

- Add Go quickstart guide with stdlib, Gin, and Echo examples
- Add Python quickstart guide with FastAPI, Flask, Django
- Add Go cookbook: stdlib, Gin, Echo middleware recipes
- Add Python cookbook: FastAPI rate limiting recipe

All content uses Unkey v2 API only.

* Add final Python cookbook recipe and 5-minutes guide

* Update docs.json sidebar navigation

- Add Go and Python quickstart guides to Framework Guides
- Add Go and Python cookbook recipes to Recipes section
- Remove duplicate 5-minutes quickstart file

* Add Go examples to quickstart and reorganize cookbook by language

- Add Go code examples to /quickstart/quickstart.mdx for key creation and verification
- Reorganize cookbook recipes into subsections: TypeScript, Go, Python, General
- Keep existing TypeScript and Python examples in quickstart

* Update cookbook index with new Go and Python recipes

* Fix code issues in Go and Python documentation

- Fix int to string conversion in go-gin-middleware (use strconv)
- Fix middleware composition in go-stdlib-middleware
- Fix wait calculation in python-fastapi-ratelimit (use total_seconds)
- Fix headers attachment in python-fastapi-ratelimit (use JSONResponse)
- Fix nil pointer dereference in quickstart/go
- Fix unsafe type assertion in quickstart/go

* Fix async/sync issue and nil pointer in quickstart docs

- Use verify_key_async in Python async route
- Add nil check for result.Code in Go quickstart

* Fix more code issues in documentation

- Fix GetUnkeyResult type assertion in go-gin-middleware
- Fix imports in python-fastapi-ratelimit (add JSONResponse, remove unused timedelta)
- Update basic rate limit example to use async API with context manager
- Add missing os import in Django settings snippet

* Fix missing os import in python-flask-auth.mdx

* Fix unsafe type assertions in Go middleware docs

- Fix RequirePermission in go-echo-middleware with safe type assertion
- Fix GetUnkeyResult in go-echo-middleware with safe type assertion
- Fix RequirePermission in go-gin-middleware with safe type assertion

* Fix error handling in Python docs - replace ApiError with UnkeyError

* Update legacy analytics documentation

- Replace outdated /apis/features/analytics.mdx with minimal reference page
- Remove analytics from API Keys sidebar in docs.json
- Add redirect from /apis/features/analytics to /analytics/overview

* fix

* Update to mint

* Fix critical type assertion issues in go-gin-middleware

- Store pointer to struct in context (not value) for type assertion compatibility
- Add checked type assertion in RequireRole with proper error handling

* Add it back

* fix the comma

* revert

* Update go examples

* cookbook update

* update quickstart

* remove analytics page that is redirected

* Update web/apps/docs/cookbook/go-echo-middleware.mdx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update web/apps/docs/cookbook/go-echo-middleware.mdx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix: deploy quick fixes (#5085)

* fix: fetch correct deployment+sentinel

* fix: add missing team switcher hover indicator

* refactor: use the same empty text

* fix: lock network view and fix generate dummy network

* fix: safari rendering issue of network

* chore: fmt

* fix: build

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Flo <53355483+Flo4604@users.noreply.github.com>
Co-authored-by: James P <james@unkey.com>

* docs: remove duplicate onboarding page (#5035)

Remove quickstart/onboarding/onboarding-api.mdx which duplicates content from the new quickstart. Redirects already exist in docs.json.

Generated-By: mintlify-agent

Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
Co-authored-by: Andreas Thomas <dev@chronark.com>
Co-authored-by: James P <james@unkey.com>

* docs: remove deprecated Vercel integration page (#5034)

The Vercel integration is currently not supported. Remove the page to avoid confusing users.

Generated-By: mintlify-agent

Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
Co-authored-by: James P <james@unkey.com>

* fix: schema cache (#5116)

* fix: do background gossip connect (#5119)

* fix: do background gossip connect

* bazel happy

* chore: debug wan failures (#5124)

* chore: debug wan failures

* add log writer

* bazel ..........

* bazel ..........

* fix: a user cannot click outside of the org selection modal (#5031)

* fix: a user cannot click outside of the org selection modal

* use errorMessage instead of hard coding messages

* restore x closing functionality

* fix rabbit, fix flash of empty state

* clear last used workspace when auto-selection fails

* remove unused conditional

---------

Co-authored-by: James P <james@unkey.com>

* sentinel prewarm cache (#5071)

* fix: cleanup project side nav

* feat: simplify deployment overview page

only show build logs until it's built, then show domains and network

* feat: sentinels prewarm their cache

it's not optmized, but pretty neat

---------

Co-authored-by: Flo <53355483+Flo4604@users.noreply.github.com>

* fix: ignore empty wan (#5122)

Co-authored-by: Andreas Thomas <dev@chronark.com>
Co-authored-by: James P <james@unkey.com>

* docs: move docs (#5125)

* refactor: deploy settings tanstack (#5104)

* refactor: move them to tanstack

* refactor: tidy up

* feat: add env provider to decide what env we are on

* refactor: tidy

* feat: add scroll into view for settingcard

* fix: bg

* refactor: remove toasts from env-vars

* chore: tidy

* fix: build

* feat: vault bulk en/decrypt (#5127)

* feat: vault bulk en/decrypt

* oops wrong file

* cleanup proto

* [autofix.ci] apply automated fixes

* cleanup

* cleanup

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* feat: trace generated rpc clients (#5128)

* feat: trace generated rpc clients

* ignore not found

* fix: docs generator paths (#5136)

* fix: retry memberlist creation (#5134)

* fix: retry memberlist creation

* remove comments

* move to const

* fix: Restore filtering on logs (#5138)

* Restore filtering on logs

Restores filtering on the logs.

* [autofix.ci] apply automated fixes

* fmt

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* fix: resolve dns to ip (#5139)

* fix: resolve dns to ip

* rabbit comments

* Fix/issue 5132 billing section widths (#5140)

* fix: Billing page has inconsistent section widths (#5132)

Standardized all SettingCard components to use consistent width classes:
- Updated Usage component: contentWidth changed from 'w-full lg:w-[320px]' to 'w-full'
- Updated CancelAlert component: contentWidth changed from 'w-full lg:w-[320px]' to 'w-full'
- Updated Billing Portal in client.tsx: contentWidth changed from 'w-full lg:w-[320px]' to 'w-full'
- Updated CurrentPlanCard component: removed min-w-[200px] from className for consistency

All billing sections now use contentWidth='w-full' for consistent layout.

Fixes #5132

* Fix billing and setting cards

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* pnpm i

* No virtualization

* pagination footer

* sorting and pagination changes

* refactor

* exports

* move data-table to ui

* install

* fmt

* Footer style changes

* sorting and pagination changes

* sorting and footer loading fix

* cleanup

* prefetch pages

* changes for review comments from rabbit and meg

* Ref fix and removed not needed import

* [autofix.ci] apply automated fixes

* sorting fix and key navigation

* review changes mess

* minor rabbit changes

* Update loading-indicator animation delay

* style change on pageination footer

* ref type change

---------

Co-authored-by: Andreas Thomas <dev@chronark.com>
Co-authored-by: Meg Stepp <mcstepp@users.noreply.github.com>
Co-authored-by: Flo <53355483+Flo4604@users.noreply.github.com>
Co-authored-by: Oz <21091016+ogzhanolguncu@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: James P <james@unkey.com>
Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
Co-authored-by: gui martins <guilhermev2huehue@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Vansh Malhotra <vansh.malhotra439@gmail.com>
Co-authored-by: Flo <flo@unkey.com>
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