1
0
mirror of https://github.com/microsoft/TypeScript-Node-Starter.git synced 2025-11-09 20:37:26 +00:00

found a better config setup I like

This commit is contained in:
Bowden
2018-01-04 16:29:01 -08:00
parent 7974d20503
commit d822f12121
5 changed files with 6 additions and 28 deletions

View File

@@ -3,7 +3,8 @@
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/dist": true
"**/dist": true,
"**/coverge": true
},
"typescript.referencesCodeLens.enabled": true,
"tslint.ignoreDefinitionFiles": false,

View File

@@ -1,11 +0,0 @@
:: Note we depend on NODE_ENV being set to dictate which of the env variables below get loaded at runtime.
:: See README for more details
:: Database connection strings below. You'll eventually have a lot of these!
:: Get this from https://mlab.com/home after you've logged in and created a database
set MONGODB_URI=mongodb://<mlab_user>:<mlab_password>@<mlab_connection_url>
:: This is standard if you have mongodb running locally and you didn't change default ports
set MONGODB_URI_LOCAL=mongodb://localhost:27017
:: Put lots of randomness in this
set SESSION_SECRET=ashdfjhasdlkjfhalksdjhflak

View File

@@ -1,12 +0,0 @@
# Note we depend on NODE_ENV being set to dictate which of the env variables below get loaded at runtime.
# See README for more details
# Database connection strings below. You'll eventually have a lot of these!
# Get this from https://mlab.com/home after you've logged in and created a database
export MONGODB_URI="mongodb://<mlab_user>:<mlab_password>@<mlab_connection_url>"
# This is standard if you have mongodb running locally and you didn't change default ports
export MONGODB_URI_DEV="mongodb://localhost:27017"
# Put lots of randomness in these
export SESSION_SECRET="ashdfjhasdlkjfhalksdjhflak"
export SESSION_SECRET_DEV="ashdfjhasdlkjfhalksdjhflak"

View File

@@ -14,9 +14,6 @@ import * as expressValidator from "express-validator";
import * as bluebird from "bluebird";
import { MONGODB_URI, SESSION_SECRET } from "./util/loadSecrets";
console.log(MONGODB_URI);
console.log(SESSION_SECRET);
const MongoStore = mongo(session);
// Controllers (route handlers)

View File

@@ -1,7 +1,10 @@
// import log from './logger'; TODO
import * as dotenv from "dotenv";
export const ENVIRONMENT = process.env.NODE_ENV;
const prod = ENVIRONMENT === "production";
const prod = ENVIRONMENT === "production"; // Anything else is treated as 'dev'
dotenv.config({ path: ".env.example" });
export const SESSION_SECRET = process.env["SESSION_SECRET"];
export const MONGODB_URI = prod ? process.env["MONGODB_URI"] : process.env["MONGODB_URI_LOCAL"];