UNPKG

@dotenc/cli

Version:

🔐 Secure, encrypted environment variables that live in your codebase

22 lines (21 loc) 895 B
import chalk from "chalk"; import { getKey } from "../../helpers/key.js"; import { getProjectConfig } from "../../helpers/projectConfig.js"; import { chooseEnvironmentPrompt } from "../../prompts/chooseEnvironment.js"; export const keyExportCommand = async (environmentArg) => { const { projectId } = await getProjectConfig(); if (!projectId) { console.error('No project found. Run "dotenc init" to create one.'); return; } let environment = environmentArg; if (!environment) { environment = await chooseEnvironmentPrompt("What environment do you want to export the key from?"); } const key = await getKey(environment); if (!key) { console.error(`\nNo key found for the ${chalk.cyan(environment)} environment.`); return; } console.log(`\nKey for the ${chalk.cyan(environment)} environment: ${chalk.gray(key)}`); };