UNPKG

@acurast/cli

Version:

A cli to interact with the Acurast Cloud.

45 lines 1.54 kB
import 'dotenv/config'; const RPC_CANARY = 'wss://canarynet-ws-1.acurast-h-server-2.papers.tech'; const IPFS_PROXY = 'https://ipfs-proxy.acurast.prod.gke.papers.tech'; const defaultValues = { ACURAST_MNEMONIC: undefined, ACURAST_IPFS_URL: IPFS_PROXY, ACURAST_IPFS_API_KEY: '', // With the default IPFS Proxy, no API key is required ACURAST_RPC: RPC_CANARY, DEBUG: 'false', }; export const getEnv = (key) => { const value = process.env[key]; if (!value) { const defaultValue = defaultValues[key]; if (defaultValue === undefined) { throw new Error(`"${key}" is not defined in the environment.`); } return defaultValue; } return value; }; export const validateDeployEnvVars = () => { getEnv('ACURAST_MNEMONIC'); getEnv('ACURAST_IPFS_URL'); getEnv('ACURAST_IPFS_API_KEY'); }; export const getProjectEnv = (key) => { if (Object.keys(defaultValues).includes(key)) { throw new Error(`Key ${key} is a CLI env variable and cannot be used as a project environment variable.`); } const value = process.env[key]; if (!value) { throw new Error(`"${key}" is not defined in the environment.`); } return value; }; export const getProjectEnvVars = (config) => { var _a; return (((_a = config.includeEnvironmentVariables) === null || _a === void 0 ? void 0 : _a.map((key) => ({ key, value: getProjectEnv(key), }))) || []); }; export const RPC = getEnv('ACURAST_RPC'); //# sourceMappingURL=config.js.map