How to use the @clevercloud/client/cjs/api/application.js.updateEnvVar function in @clevercloud/client

To help you get started, we’ve selected a few @clevercloud/client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CleverCloud / clever-tools / src / commands / env.js View on Github external
async function set (params) {
  const [envName, value] = params.args;
  const { alias } = params.options;

  const nameIsValid = validateName(envName);
  if (!nameIsValid) {
    throw new Error(`Environment variable name ${envName} is invalid`);
  }

  const { org_id, app_id: appId } = await AppConfig.getAppData(alias).toPromise();

  await application.updateEnvVar({ id: org_id, appId, envName }, { value }).then(sendToApi);

  Logger.println('Your environment variable has been successfully saved');
};