UNPKG

dagger-env

Version:

A type-safe, reusable environment configuration abstraction for Dagger modules.

76 lines 3.11 kB
import { z } from 'zod/v4'; import type { DaggerEnv, DaggerEnvConfig } from './dagger-env.js'; /** * A single secret returned by `infisical export --format=json` */ export type InfisicalSecret = z.infer<typeof InfisicalSecret>; export declare const InfisicalSecret: z.ZodObject<{ key: z.ZodString; value: z.ZodString; }, z.core.$strip>; /** * Infisical secrets provider configuration */ export interface InfisicalProviderConfig { /** Infisical project ID */ projectId: string; /** Infisical environment slug (e.g. `prod`) */ env: string; /** Infisical folder path to fetch secrets from (e.g. `/ci/my-repo`) */ path: string; } /** * 1Password secrets provider configuration */ export interface OnePasswordProviderConfig { /** 1Password vault ID */ opVault: string; /** 1Password item ID */ opItem: string; /** 1Password sections to include for secrets */ opSections: Array<{ label: string; id: string; }>; } /** * Configuration shared by all secrets providers */ export interface RunDaggerCommandBaseConfig<T extends DaggerEnvConfig = DaggerEnvConfig> { /** Commands that should include Docker socket if available */ dockerCommands?: string[]; /** Hook to run before executing the command (e.g., vendor file setup) */ beforeCommand?: () => Promise<void>; /** DaggerEnv instance for schema validation and type safety */ daggerEnv: DaggerEnv<T>; /** * Secrets to pass to Dagger alongside the ones fetched from the provider, * taking precedence on conflict. Entries with an undefined value are * skipped, so short-lived credentials that only exist in some environments * (e.g. a CI-issued token) can be forwarded without a separate config path. */ additionalSecrets?: Record<string, string | undefined>; } /** * Configuration for running Dagger commands with Infisical or 1Password integration */ export type RunDaggerCommandConfig<T extends DaggerEnvConfig = DaggerEnvConfig> = RunDaggerCommandBaseConfig<T> & (InfisicalProviderConfig | OnePasswordProviderConfig); /** * Options for individual command execution */ export interface RunDaggerCommandOptions { /** Arguments to pass to the Dagger command */ args?: Record<string, any>; /** Additional environment variables */ env?: Record<string, string>; /** Additional command-line arguments */ extraArgs?: string[]; } /** * Creates a function to run Dagger commands with Infisical or 1Password integration * @param config Configuration for the command runner * @returns Function to execute Dagger commands */ export declare function createDaggerCommandRunner<T extends DaggerEnvConfig>(config: RunDaggerCommandBaseConfig<T> & InfisicalProviderConfig): (commandName: string, options?: RunDaggerCommandOptions) => Promise<void>; export declare function createDaggerCommandRunner<T extends DaggerEnvConfig>(config: RunDaggerCommandBaseConfig<T> & OnePasswordProviderConfig): (commandName: string, options?: RunDaggerCommandOptions) => Promise<void>; //# sourceMappingURL=run-dagger-cmd.d.ts.map