mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-19 20:29:17 +00:00
deployment configuration
This commit is contained in:
7
backend/.env.example
Normal file
7
backend/.env.example
Normal file
@@ -0,0 +1,7 @@
|
||||
NODE_ENV=development
|
||||
PORT=8080
|
||||
|
||||
DB_HOST=
|
||||
DB_USER=
|
||||
DB_PASS=
|
||||
DB_NAME=
|
||||
3
backend/.gitignore
vendored
3
backend/.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
node_modules
|
||||
public/*
|
||||
public/*
|
||||
.env
|
||||
@@ -1,3 +1,4 @@
|
||||
require("dotenv/config");
|
||||
const express = require("express");
|
||||
const path = require("path");
|
||||
const cors = require("cors");
|
||||
@@ -46,7 +47,7 @@ app.use((error, req, res, next) => {
|
||||
sequelize
|
||||
.sync()
|
||||
.then(() => {
|
||||
const server = app.listen(8080);
|
||||
const server = app.listen(process.env.PORT);
|
||||
const io = require("./socket").init(server);
|
||||
io.on("connection", socket => {
|
||||
console.log("Client Connected");
|
||||
@@ -64,11 +65,11 @@ sequelize
|
||||
});
|
||||
});
|
||||
|
||||
wBot.init().then(res => {
|
||||
wBot.init().then(() => {
|
||||
wbotMessageListener();
|
||||
wbotMonitor();
|
||||
});
|
||||
console.log("Server started");
|
||||
console.log("Server started on", process.env.PORT);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
|
||||
@@ -82,7 +82,7 @@ exports.getContactMessages = async (req, res, next) => {
|
||||
...message.dataValues,
|
||||
mediaUrl: `${
|
||||
message.mediaUrl
|
||||
? `http://localhost:8080/public/${message.mediaUrl}`
|
||||
? `http://localhost:${process.env.PORT}/public/${message.mediaUrl}`
|
||||
: ""
|
||||
}`,
|
||||
};
|
||||
|
||||
@@ -82,7 +82,7 @@ const wbotMessageListener = () => {
|
||||
...newMessage.dataValues,
|
||||
mediaUrl: `${
|
||||
newMessage.mediaUrl
|
||||
? `http://localhost:8080/public/${newMessage.mediaUrl}`
|
||||
? `http://localhost:${process.env.PORT}/public/${newMessage.mediaUrl}`
|
||||
: ""
|
||||
}`,
|
||||
},
|
||||
|
||||
5
backend/package-lock.json
generated
5
backend/package-lock.json
generated
@@ -754,6 +754,11 @@
|
||||
"is-obj": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"dotenv": {
|
||||
"version": "8.2.0",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
|
||||
"integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw=="
|
||||
},
|
||||
"dottie": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/dottie/-/dottie-2.0.2.tgz",
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"dependencies": {
|
||||
"bcryptjs": "^2.4.3",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^8.2.0",
|
||||
"express": "^4.17.1",
|
||||
"express-validator": "^6.5.0",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
require("dotenv/config");
|
||||
const Sequelize = require("sequelize");
|
||||
|
||||
const sequelize = new Sequelize("econo_whatsbot", "root", "nodecomplete", {
|
||||
const sequelize = new Sequelize({
|
||||
define: {
|
||||
charset: "utf8mb4",
|
||||
collate: "utf8mb4_bin",
|
||||
},
|
||||
dialect: "mysql",
|
||||
timezone: "-03:00",
|
||||
host: "localhost",
|
||||
host: process.env.DB_HOST,
|
||||
database: process.env.DB_NAME,
|
||||
username: process.env.DB_USER,
|
||||
password: process.env.DB_PASS,
|
||||
logging: false,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user