mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-20 04:39:20 +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
|
node_modules
|
||||||
public/*
|
public/*
|
||||||
|
.env
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
require("dotenv/config");
|
||||||
const express = require("express");
|
const express = require("express");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const cors = require("cors");
|
const cors = require("cors");
|
||||||
@@ -46,7 +47,7 @@ app.use((error, req, res, next) => {
|
|||||||
sequelize
|
sequelize
|
||||||
.sync()
|
.sync()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const server = app.listen(8080);
|
const server = app.listen(process.env.PORT);
|
||||||
const io = require("./socket").init(server);
|
const io = require("./socket").init(server);
|
||||||
io.on("connection", socket => {
|
io.on("connection", socket => {
|
||||||
console.log("Client Connected");
|
console.log("Client Connected");
|
||||||
@@ -64,11 +65,11 @@ sequelize
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
wBot.init().then(res => {
|
wBot.init().then(() => {
|
||||||
wbotMessageListener();
|
wbotMessageListener();
|
||||||
wbotMonitor();
|
wbotMonitor();
|
||||||
});
|
});
|
||||||
console.log("Server started");
|
console.log("Server started on", process.env.PORT);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ exports.getContactMessages = async (req, res, next) => {
|
|||||||
...message.dataValues,
|
...message.dataValues,
|
||||||
mediaUrl: `${
|
mediaUrl: `${
|
||||||
message.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,
|
...newMessage.dataValues,
|
||||||
mediaUrl: `${
|
mediaUrl: `${
|
||||||
newMessage.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"
|
"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": {
|
"dottie": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/dottie/-/dottie-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/dottie/-/dottie-2.0.2.tgz",
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "^2.4.3",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
|
"dotenv": "^8.2.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"express-validator": "^6.5.0",
|
"express-validator": "^6.5.0",
|
||||||
"jsonwebtoken": "^8.5.1",
|
"jsonwebtoken": "^8.5.1",
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
|
require("dotenv/config");
|
||||||
const Sequelize = require("sequelize");
|
const Sequelize = require("sequelize");
|
||||||
|
|
||||||
const sequelize = new Sequelize("econo_whatsbot", "root", "nodecomplete", {
|
const sequelize = new Sequelize({
|
||||||
define: {
|
define: {
|
||||||
charset: "utf8mb4",
|
charset: "utf8mb4",
|
||||||
collate: "utf8mb4_bin",
|
collate: "utf8mb4_bin",
|
||||||
},
|
},
|
||||||
dialect: "mysql",
|
dialect: "mysql",
|
||||||
timezone: "-03:00",
|
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,
|
logging: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useHistory } from "react-router-dom";
|
||||||
import api from "../../util/api";
|
import api from "../../util/api";
|
||||||
import clsx from "clsx";
|
|
||||||
import MainDrawer from "../../components/Layout/MainDrawer";
|
import MainDrawer from "../../components/Layout/MainDrawer";
|
||||||
import openSocket from "socket.io-client";
|
import openSocket from "socket.io-client";
|
||||||
|
|
||||||
@@ -84,12 +83,10 @@ const WhatsAuth = () => {
|
|||||||
return () => {
|
return () => {
|
||||||
socket.disconnect();
|
socket.disconnect();
|
||||||
};
|
};
|
||||||
}, []);
|
}, [history]);
|
||||||
|
|
||||||
console.log(session);
|
console.log(session);
|
||||||
|
|
||||||
const fixedHeightPaper = clsx(classes.paper, classes.fixedHeight);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<MainDrawer appTitle="QR Code">
|
<MainDrawer appTitle="QR Code">
|
||||||
|
|||||||
@@ -1,17 +1,8 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import QRCode from "qrcode.react";
|
import QRCode from "qrcode.react";
|
||||||
import { makeStyles } from "@material-ui/core/styles";
|
|
||||||
import Typography from "@material-ui/core/Typography";
|
import Typography from "@material-ui/core/Typography";
|
||||||
|
|
||||||
const useStyles = makeStyles({
|
|
||||||
main: {
|
|
||||||
flex: 1,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const Qrcode = ({ qrCode }) => {
|
const Qrcode = ({ qrCode }) => {
|
||||||
const classes = useStyles();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Typography component="h2" variant="h6" color="primary" gutterBottom>
|
<Typography component="h2" variant="h6" color="primary" gutterBottom>
|
||||||
|
|||||||
Reference in New Issue
Block a user