Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kody/vercel

src/create-env-var.js

21 lines · 1014 B · JavaScript
import { createEnvVar } from './vercel.js'

/**
 * Create a project environment variable.
 * Requires `dryRun: true` to preview or `confirm: true` to write.
 * Dry-run previews redact `value`.
 * @param {Object} input
 * @param {string} input.project Project id or name.
 * @param {string} input.key Variable name.
 * @param {string} input.value Variable value.
 * @param {string[]|string} [input.target] `production`, `preview`, and/or `development`.
 * @param {boolean} [input.dryRun] Return the request preview without creating the variable.
 * @param {boolean} [input.confirm] Required for the live write.
 * @returns {Promise<Record<string, unknown>>} Created env metadata or dry-run preview.
 * @example
 * import createEnvVar from 'kody:@kody/vercel/create-env-var'
 * const preview = await createEnvVar({ project: 'example-app', key: 'EXAMPLE_FLAG', value: '1', target: ['preview'], dryRun: true })
 */
export default async function createEnvVarEntrypoint(input = {}) {
	return await createEnvVar(input)
}