Skip to content

Commit

Permalink
✨ Configure the dotenv
Browse files Browse the repository at this point in the history
  • Loading branch information
marcobrunodev committed Mar 1, 2020
1 parent a036c75 commit 0708c6b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/api/lib/mail.lib.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { config } from 'dotenv';
import sendgridMail from '@sendgrid/mail';

config();

const { SENDGRID_API_KEY } = process.env;
sendgridMail.setApiKey(SENDGRID_API_KEY);

Expand Down
4 changes: 3 additions & 1 deletion src/api/server.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { config } from 'dotenv';
import fastify from 'fastify';

import routes from './routes';

config();

const logger = process.env.NODE_ENV === 'development';
const server = fastify({ logger });

Expand Down
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { config } from 'dotenv';
import server from './api/server';

config();

const start = async () => {
try {
const { PORT, HOST } = process.env;
Expand Down

0 comments on commit 0708c6b

Please sign in to comment.