config.js 6.7 KB
// # config

var path = require('path');

var parentDir = path.join(__dirname, '..', '..');
var appDir = path.join(parentDir, 'server');

var pkg = require(path.join(parentDir, 'package'));

var assetsDir = path.join(parentDir, 'build');
var publicDir = path.join(assetsDir, 'public');
var templatesDir = path.join(assetsDir, 'emails');
var viewsDir = path.join(appDir, 'views');

var maxAge = 24 * 60 * 60 * 1000;//60 * 60 * 1000;

exports = module.exports = function () {

  return {
    defaults: {
      basicAuth: {
        enabled: false,
        name: 'admin',
        pass: 'password'
      },
      facebook: {
        enabled: false,
        appID: '',
        appSecret: '',
        scope: ['email']
      },
      google: {
        enabled: false,
        scope: [
          'https://www.googleapis.com/auth/userinfo.profile',
          'https://www.googleapis.com/auth/userinfo.email'
        ],
        clientID: '',
        clientSecret: ''
      },
      pkg: pkg,
      cache: false,
      showStack: true,
      assetsDir: assetsDir,
      publicDir: publicDir,
      views: {
        dir: viewsDir,
        engine: 'ejs'
      },
      password: {
        minStrength: 0,
        limitAttempts: false
      },
      email: {
        templates: {
          dir: templatesDir,
          options: {
          }
        },
        // <https://github.com/andris9/Nodemailer>
        transport: {
          service: 'gmail',
          auth: {
            user: 'hi@eskimo.io',
            pass: 'abc123'
          }
        },
        headers: {
          from: 'hi@eskimo.io'
        }
      },
      hipchat: {
        level: 'error',
        silent: false,
        token: '',
        notify: false,
        color: 'yellow',
        room: '',
        from: '',
        messageFormat: 'text'
      },
      session: {
        secret: 'igloo-change-me',
        key: 'igloo',
        cookie: {
          path: '/',
          httpOnly: true,
          secure: false,
          sameSite: 'strict',
          maxAge: maxAge
        },
        resave: true,
        saveUninitialized: true
      },
      trustProxy: true,
      updateNotifier: {
        enabled: true,
        dependencies: {},
        updateCheckInterval: 1000 * 60 * 60,
        updateCheckTimeout: 1000 * 20
      },
      staticServer: {
        maxAge: maxAge
      },
      server: {
        host: 'localhost',
        cluster: false,
        ssl: {
          enabled: false,
          options: {}
        }
      },
      cookieParser: 'igloo-change-me',
      csrf: {
        enabled: false,
        options: {
          cookie: {
            maxAge: maxAge
          }
        }
      },
      mongo: {
        host: 'localhost',
        port: 27017,
        opts: {},
        // faster - don't perform 2nd request to verify
        // log message was received/saved
        safe: false
      },
      knex: {
        client: 'mysql'
      },
      redis: {
        host: '192.168.2.70',
        port: 38888,
        pass: 'Q*Kr4?#Rg!',
        maxAge: maxAge
      },
      output: {
        handleExceptions: false,
        colorize: true,
        prettyPrint: false
      },
      logger: {
        'console': true,
        requests: true,
        mongo: false,
        file: false,
        hipchat: false,
        slack: false
      },
      less: {
        path: publicDir,
        options: {
          force: true
        }
      },
      jade: {
        amd: {
          path: '/js/tmpl/',
          options: {}
        }
      },
      liveReload: {
        port: 35729
      },
      restful: {
        url: 'http://154.8.229.55:20000/',
        // url:'http://192.144.144.220:20000/',
        //url:'http://127.0.0.1:20000/',
        // url:'http://140.143.196.80:20000/',
        ossUrl: 'http://192.168.2.72:20000/',
        version: '/v1'
      },
      prefix: '/',
      localStrategy: {
        usernameField: 'username',
        passwordField: 'password',
        // session: false,
        passReqToCallback: true
      }
    },
    test: {
      cache: true,
      url: 'http://localhost:5999',
      showStack: false,
      updateNotifier: {
        enabled: false,
      },
      restful: {
        url: 'http://172.21.0.8:20000/',
        ossUrl: 'http://172.21.0.8:10001/v1/',
        version: '/v1'
      },
      server: {
        host: '0.0.0.0',
        env: 'production',
        port: 5999,
        cluster: false
      },
      redis: {
        prefix: 'igloo_production_test_develop',
        host: '172.21.0.8',
        port: 38888,
        pass: 'Q*Kr4?#Rg!'
      },
      logger: {
        'console': true,
        requests: true,
        mongo: false,
        file: {
          filename: '/opt/work/hro/frontend/hro-develop/igloo.log',
          timestamp: true
        }
      }
    },
    development: {
      cache: true,
      url: 'http://localhost:3000',
      server: {
        env: 'development',
        port: 3000,
      },
      mongo: {
        dbname: 'igloo-development',
        db: 'igloo-development' // keep for winston logger
      },
      knex: {
        debug: true,
        connection: {
          host: '127.0.0.1',
          user: 'root',
          password: '',
          database: 'igloo_development'
        }
      },
      redis: {
        prefix: 'igloo-development',
        host: '127.0.0.1',
        port: 6379,
        pass: '',
      }
    },
    production: {
      cache: false,
      url: 'http://localhost:6868',
      views: {
        dir: viewsDir,
      },
      publicDir: publicDir,
      showStack: false,
      updateNotifier: {
        enabled: false,
      },
      restful: {
        url: 'http://192.168.2.72:20000/',
        ossUrl: 'http://192.168.2.72:20000/',
        version: '/v1',
        host: '192.168.2.72',
        port: 20000
      },
      server: {
        host: '0.0.0.0',
        env: 'production',
        port: 6868,
        cluster: false
      },
      mongo: {
        dbname: 'igloo-production',
        db: 'igloo-production' // keep for winston logger
      },
      knex: {
        connection: {
          host: '127.0.0.1',
          user: 'root',
          password: '',
          database: 'igloo_production'
        }
      },
      redis: {
        prefix: 'igloo_production',
        host: '127.0.0.1',
        port: 38888,
        pass: 'Q*Kr4?#Rg!'
      },
      csrf: {
        enabled: true,
        options: {
          cookie: {
            maxAge: maxAge,
            sameSite: 'strict',
            path: '/',
            key: '_csrf',
            httpOnly: true
          }
        }
      },
      output: {
        colorize: false
      },
      logger: {
        'console': true,
        requests: true,
        mongo: false,
        file: {
          filename: '/opt/work/hro/frontend/hro/igloo.log',
          timestamp: true
        }
      }
    }
  };
};

exports['@singleton'] = true;