How to use processenv - 5 common examples

To help you get started, we’ve selected a few processenv 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 thenativeweb / flaschenpost / lib / flaschenpost.ts View on Github external
public constructor () {
    const stringifiedDebugModuleFilter = processenv('LOG_DEBUG_MODULE_FILTER', '');

    if (typeof stringifiedDebugModuleFilter !== 'string') {
      throw new Error('Debug module filter invalid.');
    }

    const debugModuleFilter = stringifiedDebugModuleFilter.
      split(',').
      filter((item: string): boolean => Boolean(item));

    let formatter = process.stdout.isTTY ? asHumanReadable : asJson;

    const formatterOverride = processenv('LOG_FORMATTER');

    if (formatterOverride) {
      formatter = formatterOverride === 'human' ? asHumanReadable : asJson;
    }
github thenativeweb / flaschenpost / lib / flaschenpost.ts View on Github external
throw new Error('Debug module filter invalid.');
    }

    const debugModuleFilter = stringifiedDebugModuleFilter.
      split(',').
      filter((item: string): boolean => Boolean(item));

    let formatter = process.stdout.isTTY ? asHumanReadable : asJson;

    const formatterOverride = processenv('LOG_FORMATTER');

    if (formatterOverride) {
      formatter = formatterOverride === 'human' ? asHumanReadable : asJson;
    }

    const logLevel = processenv('LOG_LEVEL', 'info');

    if (!isLogLevel(logLevel)) {
      throw new Error(`Log level '${logLevel}' unknown.`);
    }

    const highestEnabledLogLevel = logLevel;

    const hostname = os.hostname();

    const logEntryIdGenerator = getLogEntryIdGenerator();

    this.configuration = new Configuration(
      debugModuleFilter,
      formatter,
      highestEnabledLogLevel,
      hostname,
github thenativeweb / flaschenpost / lib / flaschenpost.ts View on Github external
public constructor () {
    const stringifiedDebugModuleFilter = processenv('LOG_DEBUG_MODULE_FILTER', '');

    if (typeof stringifiedDebugModuleFilter !== 'string') {
      throw new Error('Debug module filter invalid.');
    }

    const debugModuleFilter = stringifiedDebugModuleFilter.
      split(',').
      filter((item: string): boolean => Boolean(item));

    let formatter = process.stdout.isTTY ? asHumanReadable : asJson;

    const formatterOverride = processenv('LOG_FORMATTER');

    if (formatterOverride) {
      formatter = formatterOverride === 'human' ? asHumanReadable : asJson;
    }

    const logLevel = processenv('LOG_LEVEL', 'info');

    if (!isLogLevel(logLevel)) {
      throw new Error(`Log level '${logLevel}' unknown.`);
    }

    const highestEnabledLogLevel = logLevel;

    const hostname = os.hostname();

    const logEntryIdGenerator = getLogEntryIdGenerator();
github thenativeweb / roboter / lib / shell / execLive.js View on Github external
const execLive = async function (command, options = {}) {
  if (!command) {
    throw new Error('Command is missing.');
  }

  const cwd = options.cwd || process.cwd(),
        env = options.env || processenv(),
        maxBuffer = options.maxBuffer || 1024 * 200;

  let args,
      binary;

  if (options.args) {
    binary = command;
    ({ args } = options);
  } else {
    [ binary, ...args ] = command.split(' ');
  }
  const childProcess = execa(binary, args, { cwd, env, maxBuffer });

  if (options.silent !== true) {
    childProcess.stdout.on('data', data => ui.passThrough(data));
    childProcess.stderr.on('data', data => ui.passThrough(data, { target: 'stderr' }));
github thenativeweb / roboter / lib / runCommand.js View on Github external
const runCommand = async function (command, options = {}) {
  if (!command) {
    throw new Error('Command is missing.');
  }

  const cwd = options.cwd || process.cwd(),
        env = options.env || processenv(),
        maxBuffer = options.maxBuffer || 1024 * 200,
        silent = options.silent || false;

  return new Promise((resolve, reject) => {
    try {
      const childProcess = shell.exec(command, { cwd, env, maxBuffer, silent: true }, (exitCode, stdout, stderr) => {
        if (exitCode !== 0) {
          const ex = new errors.ExecutableFailed(stderr);

          ex.command = command;
          ex.exitCode = exitCode;
          ex.stdout = stdout;
          ex.stderr = stderr;

          return reject(ex);
        }

processenv

processenv parses environment variables.

MIT
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis

Popular processenv functions