How to use the dotenv.load 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 johnnyvf24 / hellochess-v2 / server / sockets / listeners / room.ts View on Github external
const Notifications = require('react-notification-system-redux');

import Player from '../../game_models/players/Player';
import AI from '../../game_models/players/AI';
import Room from '../../game_models/rooms/Room';
import Game from '../../game_models/games/Game';
import {Message, ResignMessage, AbortMessage} from '../../game_models/rooms/Message';

//Game Rules
import FourGame from '../../game_models/games/FourGame';
import Standard from '../../game_models/games/Standard';
import CrazyHouse from '../../game_models/games/CrazyHouse';

//server environment
const dotenv = require('dotenv').load();

const env = process.env.NODE_ENV || "development";

module.exports = function(io, socket, connection) {
    
    socket.on('new-message', data => {
        let roomName: string = data.thread;
        let player: Player = connection.getPlayerBySocket(socket);
        let room: Room = connection.getRoomByName(roomName);
        if(!room) return;
        
        //add the message to the room
        room.addMessage(new Message(player, data.msg, roomName));
        
        // tell everyone there is a new message
        io.to(room.name).emit('update-room-full', room.getRoomObjFull());
github npm / captain-hook / index.js View on Github external
// load the env file
require('dotenv').load();
var port = process.env.PORT || '6666';

// how we log
const logger = require("./src/lib/logger").logger;
const logHandler = require("./src/lib/logger").logHandler;

// how we receive npm hooks
const server = require("./src/lib/hook_receiver");

// how we post to slack
const slack = require('./src/lib/slack_client').client;
const channelID = require('./src/lib/slack_client').channelID;

// routes live in a separate place
const routes = require('./src/routes');
github DCtheTall / node-video-chat / config / config.js View on Github external
if (!process.env.NODE_ENV) require('dotenv').load(); // eslint-disable-line

const config = {
  development: {
    dialect: 'postgres',
    database: process.env.DATABASE_NAME,
    host: process.env.DATABASE_HOST,
    username: process.env.DATABASE_USER,
    password: process.env.DATABASE_PASSWORD,
    port: 5432,
  },
  production: {
    dialect: 'postgres',
    dialectOptions: {
      ssl: true,
    },
    use_env_variable: 'DATABASE_URL',
github thebergamo / ecommerce.js / src / core / server.js View on Github external
'use strict';

require('dotenv').load();

// Load deps
const Hapi = require('hapi');

const db = require('./database');

let server;

module.exports = server = new Hapi.Server();

// Set the port for listening
server.connection({
  host: process.env.SERVER_HOST || 'localhost',
  port: process.env.SERVER_PORT || '8000'
});
github strues / boldr / packages / boldr-api / src / config.js View on Github external
/* eslint-disable no-unused-vars */
const path = require('path');
const _ = require('lodash');

const pjson = require('../package.json');
require('dotenv').load({ silent: true });

const config = {
  all: {
    env: process.env.NODE_ENV || 'development',
    port: process.env.API_PORT || 2121,
    host: process.env.API_HOST || 'localhost',
    ip: process.env.IP || '0.0.0.0',
    app: pjson.name,
    version: pjson.version,
    prefix: '/api/v1',
    dateFormat: 'yyyy-MM-dd',
    timeZone: '-07:00',
    postgres: {
      uri: process.env.POSTGRES_CONN_URI,
      pool: {
        min: 2,
github opencollective / opencollective-website / test / e2e / donate_page.js View on Github external
require('dotenv').load();
const config = require('config');
const resetDb = require('../lib/reset_db.js');

module.exports = {
  '@tags': ['donate_page'],
   beforeEach: client => resetDb(client),

  'Donate button shows €100.00': (client) => {
    client
      .url(`${config.host.website}/testcollective/donate/100/February Meetup`)
      .waitForElementVisible('body', 1000)
      .assert.containsText('div[class=Tier]', 'February Meetup')
      .assert.containsText('div[class=DonateDisclaimer]', '€100,00')
      .end();
   },
github pivotalsoftware / ESarch / trader-app-ui / src / index.js View on Github external
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './containers/App';
import registerServiceWorker from './registerServiceWorker';

if (process.env.NODE_ENV !== 'production') {
  require('dotenv').load();
}

ReactDOM.render(, document.getElementById('root'));
registerServiceWorker();
github strues / boldr / packages / boldr-cms / bin / boldr.js View on Github external
require('dotenv').load();

if (process.env.NODE_ENV !== 'production') {
  throw Error('BoldrCMS is trying to run in production mode, but the NODE_ENV is not set properly.');
}

require('../boldr/boldrCMS/server');
github WhirIO / Client / Gruntfile.js View on Github external
require('dotenv').load();

module.exports = (grunt) => {
  grunt.initConfig({
    eslint: {
      target: ['./app/**/*.js']
    }
  });

  grunt.loadNpmTasks('grunt-eslint');
  grunt.registerTask('default', ['eslint']);
};
github strues / boldr / bin / boldr.js View on Github external
require('dotenv').load();

require('../boldrCMS/server/index.js');

dotenv

Loads environment variables from .env file

BSD-2-Clause
Latest version published 2 months ago

Package Health Score

94 / 100
Full package analysis