diff --git a/.vscode/settings.json b/.vscode/settings.json index 5b5df66..911ff07 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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, diff --git a/sample.cmd b/sample.cmd deleted file mode 100644 index 0d7c9db..0000000 --- a/sample.cmd +++ /dev/null @@ -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://:@ -:: 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 diff --git a/sample.sh b/sample.sh deleted file mode 100755 index 7203f2a..0000000 --- a/sample.sh +++ /dev/null @@ -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://:@" -# 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" diff --git a/src/app.ts b/src/app.ts index 8f3e089..c10a024 100644 --- a/src/app.ts +++ b/src/app.ts @@ -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) diff --git a/src/util/loadSecrets.ts b/src/util/loadSecrets.ts index 5b0a550..90b72d4 100644 --- a/src/util/loadSecrets.ts +++ b/src/util/loadSecrets.ts @@ -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"];