feat: add provider-neutral stack secret managers - #1502
Conversation
|
Good timing as I was literally just testing out alchemy + varlock integration today. I came to a similar conclusion that we need custom config providers. But also have a few small notes about how to make the integration even better so would love to coordinate. Also thinking it may make sense to just expose the new config provider surface, and reference varlock in the docs, but let Varlock own the plugin/implementation. This avoids coupling to a specific Varlock version. what’s your timeline for getting this merged? |
|
I have some concerns when it comes to varlock owning it because of the amount of breaking changes happening here, but we can discuss on Discord. Happy to collaborate |
|
Converted back to draft while locking down the config and usage |
|
Took a closer look at the latest head. The generic
|
|
This should be ready now. Varlock was removed so the maintainer can deliver that himself, but it contains the most common secrets manager solutions now, with more being added once this is merged like 1pass and Proton pass |
|
Thanks for the quick turnaround, the provider-neutral contract and Forward the export interface SecretManagerResolveOptions {
readonly stack: string;
readonly stage?: string;
/** true under `alchemy dev` (local emulation), same as the session option */
readonly dev?: boolean;
}With that, stage-to-environment mapping can live in the user's schema (varlock: |
|
You can get it from |
Adds optional stack-level secret managers so provider credentials and application configuration can come from Doppler, Infisical, AWS Secrets Manager, or an external Effect integration. A stack selects its manager with
secrets: Provider.secrets(...); application code continues usingConfigandConfig.redacted.Public API and configuration
SecretManagerservice, layer type, resolver options, andSecretManagerErrorfrom the package root. Managers implementresolve({ stack, stage, dev })and return an Effect containing either aConfigProvideror{ provider, bindings }. Provider-only adapter implementations remain compatible.SecretManagerErrorfailures during layer construction and resolution.Typed application bindings
makeSecretManagerand generic result/integration types. An external adapter can expose a standardlayerplus a typedbindingsaccessor whose property names and Config types come from its schema or generated declarations.secrets: config.layer, thenconst bindings = yield* config.bindingsandenv: { ...bindings }. The accessor uses the current session's result without loading the manager again.Config.redactedassecret_text, strings asplain_text, and other JSON values asjson. Adapter-owned runtime metadata can useConfig.succeed; deployment-only values remain available through the provider without being forwarded automatically.Local development
Forward optional
devto secret-manager resolution and built-in adapter selectors. Local emulation and a deployment can share the same stage while selecting different values. Session caching uses the effective development mode, including inherited settings and explicit overrides; programmatic stack evaluation forwards its mode too.Forward requested configuration nodes to local RPC sidecars over their existing WebSocket, without placing forwarded secret values in session URLs or adding them to child environment variables.
Preserve Effect configuration path transformations, including nested providers, fallback sources, and custom transforms applied in the sidecar.
Track observed values and missing keys across transformed views. Unchanged reloads retain provider contexts; changed configuration closes and rebuilds them so cached credentials refresh.
Forward Cloudflare tooling credentials and profile selection to Vite children through the private stdin configuration payload. Missing parent credentials cannot fall back to stale child credentials. Application
Config.redactedbindings continue through the existing Worker binding path.Included integrations and scope
SecretStringobjects, secret/version/region selectors, and static or standard AWS credential-chain authentication.alchemy/Varlockexport, optionalvarlockpeer dependency, and Varlock-specific filtering and documentation. External adapters can implement the public contract; the generic layer contains no Varlock-specific behavior.The Secrets & Config and Stack guides document the API, configuration precedence, included providers, and external layer construction. Managers resolve after stack-module import, so configuration reads belong inside Effects and Layers.
Validation