Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .env File #105

Merged
merged 10 commits into from Nov 8, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
@@ -0,0 +1,4 @@
NODE_ENV=development
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above each line, please add a comment

# NODE_ENV should be one of "development" or "production"
NODE_ENV=development

# PORT is the port used by the web server
PORT=8080

...

This example file can serve as both a template, and documentation.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • renamed .env.example to env.example
  • added instructions in contributing.md
  • added comments in env.example

PORT=8080
NODEMAILER_USERNAME=
NODEMAILER_PASSWORD=
10 changes: 10 additions & 0 deletions config/config.js
@@ -0,0 +1,10 @@
const dotenv = require('dotenv');

dotenv.config();

module.exports = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder about this vs. just letting people use process.env everywhere. If we go with this approach, then every file has to require this file. If we leave it all on process.env.* we don't.

I'd suggest we remove this and export nothing from config.js, and just make sure we require('./config') early in the code.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, do you want me to add

const dotenv = require('dotenv');
dotenv.config();

at the very beginning of index.js for now ?

port: process.env.PORT,
env: process.env.NODE_ENV,
user: process.env.NODEMAILER_USERNAME,
pass: process.env.NODEMAILER_PASSWORD,
};
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -18,7 +18,8 @@
"homepage": "https://github.com/Seneca-CDOT/telescope#readme",
"dependencies": {
"bent": "^7.0.2",
"bull": "^3.11.0"
"bull": "^3.11.0",
"dotenv": "^8.2.0"
},
"devDependencies": {
"eslint": "^6.6.0",
Expand Down