-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f94f1d
commit 3c36a8d
Showing
11 changed files
with
213 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules | ||
node_modules | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Use an official Node.js runtime as a parent image | ||
FROM node:alpine | ||
|
||
# Set the working directory to /app | ||
WORKDIR /app | ||
|
||
# Copy package.json and package-lock.json to the container | ||
COPY package*.json ./ | ||
|
||
# Install pm2 | ||
RUN npm install pm2 -g | ||
|
||
# Install app dependencies | ||
RUN npm ci | ||
|
||
# Copy the rest of the app source code to the container | ||
COPY . . | ||
|
||
# Start the app by running the "npm start" command | ||
CMD ["npm", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const dotenv = require("dotenv"); | ||
const path = require("path"); | ||
const Joi = require("joi"); | ||
|
||
dotenv.config({ path: path.join(__dirname, "../.env") }); | ||
|
||
const envVarsSchema = Joi.object() | ||
.keys({ | ||
NODE_ENV: Joi.string() | ||
.valid("production", "development", "test") | ||
.required(), | ||
RABBITMQ: Joi.string(), | ||
RABBITMQ_EXCHANGE_NAME: Joi.string(), | ||
RABBITMQ_QUEUE_NAME: Joi.string(), | ||
RABBITMQ_BINDING_KEY: Joi.string(), | ||
SMTP_PORT: Joi.string(), | ||
SMTP_HOST: Joi.string(), | ||
SMTP_USERNAME: Joi.string(), | ||
SMTP_PASSWORD: Joi.string(), | ||
}) | ||
.unknown(); | ||
|
||
const { value: envVars, error } = envVarsSchema | ||
.prefs({ errors: { label: "key" } }) | ||
.validate(process.env); | ||
|
||
if (error) { | ||
throw new Error(`Config validation error: ${error.message}`); | ||
} | ||
|
||
module.exports = { | ||
rabbitmq: { | ||
url: envVars.RABBITMQ, | ||
exchangeName: envVars.RABBITMQ_EXCHANGE_NAME, | ||
queueName: envVars.RABBITMQ_QUEUE_NAME, | ||
bindingKey: envVars.RABBITMQ_BINDING_KEY, | ||
}, | ||
smtp: { | ||
port: envVars.SMTP_PORT, | ||
host: envVars.SMTP_HOST, | ||
username: envVars.SMTP_USERNAME, | ||
password: envVars.SMTP_PASSWORD, | ||
}, | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"apps": [ | ||
{ | ||
"name": "email_service", | ||
"script": "app.js", | ||
"instances": 1, | ||
"autorestart": true, | ||
"watch": false, | ||
"time": true, | ||
"env": { | ||
"NODE_ENV": "production" | ||
} | ||
} | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters