How to use the dotenv.config function in dotenv

To help you get started, we’ve selected a few dotenv 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 cnguy / kayn / test / specs / endpoints / matchlist.specs.js View on Github external
/* eslint-disable max-nested-callbacks */
var chai = require('chai')

var expect = chai.expect,
  should = chai.should,
  assert = chai.assert

require('dotenv').config()

var init = require('../../../utils/init')

const name = 'Contractz'
const id = 32932398
const accId = 47776491
const options = {
  queue: [420, 440],
  champion: 79
}
const region = 'na'

const badConfig = {
  options: {
    Queue: 420 // instead of queue
  }
github async-labs / saas / book / 13-end / app / server / env.ts View on Github external
// Only import this file once, at entrypoint
// See https://github.com/motdotla/dotenv/tree/master/examples/typescript

import { config } from 'dotenv';

const result = config();
// Only override process.env if .env file is present and valid
if (!result.error) {
  Object.keys(result.parsed).forEach((key) => {
    const value = result.parsed[key];
    if (value) {
      process.env[key] = value;
    }
  });
}
github async-labs / saas / book / 9-begin / api / server / env.ts View on Github external
// Only import this file once, at entrypoint
// See https://github.com/motdotla/dotenv/tree/master/examples/typescript

import { config } from 'dotenv';
const result = config();

// Only override process.env if .env file is present and valid
if (!result.error) {
  Object.keys(result.parsed).forEach((key) => {
    const value = result.parsed[key];
    if (value) {
      process.env[key] = value;
    }
  });
}
github shaunymca / coffeeapp / modules / slackPosting.js View on Github external
var slack = require('slack'),
    Q = require("q"),
    async = require('async');
require('dotenv').config();
var SlackApiToken = process.env.SLACKKEY
var coffee_channel = process.env.COFFEECHANNEL

//for testing slackbottest channel
var testing_channel = process.env.TESTINGCHANNEL

exports.postBrewing = function(user_name, user_id) {
  var botname = 'Coffee Bot'
  var icon_emoji = ":coffeemug:"
  var user_mention = '<@' + user_id + '|' + user_name +'>'
  var twelveMins = 12 * 60 * 1000 // 12 minutes to brew a pot
  var text = user_mention + ' just started brewing a pot :coffee:'
  slack.chat.postMessage({ token:SlackApiToken, channel:coffee_channel, text:text, icon_emoji:icon_emoji, username:botname}, function(err, data) {
    setTimeout(function() {
      var text = 'Coffee is ready. Thanks ' + user_mention + ' for brewing it. :coffee:'
      slack.chat.postMessage({ token:SlackApiToken, channel:coffee_channel, text:text, icon_emoji:icon_emoji, username:botname}, function(err, data) {
github Nexmo / nexmo-node-code-snippets / voice / send-dtmf-to-call.js View on Github external
'use strict';

require('dotenv').config({path: __dirname + '/../.env'});

const NEXMO_API_KEY = process.env.NEXMO_API_KEY;
const NEXMO_API_SECRET = process.env.NEXMO_API_SECRET;
const NEXMO_PRIVATE_KEY = __dirname + "/../" + process.env.NEXMO_PRIVATE_KEY;
const NEXMO_APPLICATION_ID = process.env.NEXMO_APPLICATION_ID;

const TO_NUMBER = process.env.NEXMO_TO_NUMBER;
const FROM_NUMBER = process.env.NEXMO_FROM_NUMBER;

const app = require('express')();
const bodyParser = require('body-parser');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
  extended: true
}));
github evan-mcclaugherty / express-knex-postgres-heroku-setup / knexfile.js View on Github external
require('dotenv').config();

module.exports = {
    development: {
        client: 'pg',
        connection: 'postgres://localhost/into_to_knex'
    },
    production: {
        client: 'pg',
        connection: process.env.DATABASE_URL + '?ssl=true'
    }
};
github aredotna / ervell / scripts / syncSchema.js View on Github external
require('dotenv').config();

import { execSync } from 'child_process';

execSync(
  `yarn run apollo schema:download src/v2/apollo/schema.json --endpoint=https://api.are.na/graphql --header='X-APP-TOKEN: ${
    process.env.GRAPHQL_XAPP_TOKEN
  }'`
);
github Electra-project / translectra / src / index.js View on Github external
import crypto from 'crypto'
import dotenv from 'dotenv'
import fs from 'fs'
import { Lexpress } from 'lexpress'
import lodash from 'lodash'
import moment from 'moment'
import passport from 'passport'
import passportGoogleOauth from 'passport-google-oauth'
import path from 'path'

import https from './middlewares/https'
import mongoDb from './middlewares/mongoDb'
import User from './models/User'
import routes from './routes'

dotenv.config()

passport.use(new passportGoogleOauth.OAuth2Strategy(
  {
    clientID: process.env.GOOGLE_API_KEY,
    clientSecret: process.env.GOOGLE_API_SECRET,
    callbackURL: `${process.env.WEBSITE_URL}/auth/callback`,
  },
  (accessToken, refreshToken, profile, cb) => {
    User.findOne({ googleId: profile.id }, (err, user) => {
      if (err !== null) {
        cb(err)

        return
      }

      if (!user) {
github medibloc / explorer / server / src / db / index.js View on Github external
import dotenv from 'dotenv';
import Sequelize from 'sequelize';
import logger from '../logger';
import config from '../../config';

const { DB } = config;
const env = dotenv.config().parsed;

const USERNAME = env.EXPLORER_DB_USERNAME;
const PASSWORD = env.EXPLORER_DB_PASSWORD;

const connect = ({
  database, dialect, host, password, user,
}) => {
  const sequelize = new Sequelize(database, user, password, {
    dialect,
    host,
    logging: false,
    pool: {
      acquire: 30000,
      idle: 10000,
      max: 50,
      min: 0,

dotenv

Loads environment variables from .env file

BSD-2-Clause
Latest version published 9 months ago

Package Health Score

87 / 100
Full package analysis