UNPKG

kubricate

Version:

A TypeScript framework for building reusable, type-safe Kubernetes infrastructure — without the YAML mess.

45 lines 1.36 kB
import { SecretInjectionBuilder } from './SecretInjectionBuilder.js'; export class SecretsInjectionContext { stack; manager; secretManagerId; defaultResourceId; builders = []; constructor(stack, manager, secretManagerId) { this.stack = stack; this.manager = manager; this.secretManagerId = secretManagerId; } /** * Set the default resourceId to use when no explicit resource is defined in a secret injection. */ setDefaultResourceId(id) { this.defaultResourceId = id; } /** * Start defining how a secret will be injected into a resource. * This only resolves the provider, not the actual secret value. * * @param secretName - The name of the secret to inject. * @returns A SecretInjectionBuilder for chaining inject behavior. */ secrets(secretName) { const { providerInstance, providerId } = this.manager.resolveProviderFor(String(secretName)); const builder = new SecretInjectionBuilder(this.stack, String(secretName), providerInstance, { defaultResourceId: this.defaultResourceId, secretManagerId: this.secretManagerId, providerId }); this.builders.push(builder); return builder; } resolveAll() { for (const builder of this.builders) { builder.resolveInjection(); } } } //# sourceMappingURL=SecretsInjectionContext.js.map