-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
No .env do backend deve ser passado o ID do Frontend e Backend no pm2.
- Loading branch information
Showing
7 changed files
with
82 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
NODE_ENV= | ||
BACKEND_URL=http://localhost | ||
FRONTEND_URL=http://localhost:3000 | ||
PORT=8080 | ||
PROXY_PORT=8080 | ||
CHROME_BIN=C:\Program Files\Google\Chrome\Application\chrome.exe | ||
NODE_ENV= | ||
BACKEND_URL=http://localhost | ||
FRONTEND_URL=http://localhost:3000 | ||
PORT=8080 | ||
PROXY_PORT=8080 | ||
CHROME_BIN=C:\Program Files\Google\Chrome\Application\chrome.exe | ||
|
||
DB_DIALECT=mysql | ||
DB_HOST=localhost | ||
DB_TIMEZONE=-03:00 | ||
DB_USER=root | ||
DB_PASS= | ||
DB_NAME=pressticket | ||
DB_DIALECT=mysql | ||
DB_HOST=localhost | ||
DB_TIMEZONE=-03:00 | ||
DB_USER=root | ||
DB_PASS= | ||
DB_NAME=pressticket | ||
|
||
USER_LIMIT=3 | ||
CONNECTIONS_LIMIT=1 | ||
USER_LIMIT=3 | ||
CONNECTIONS_LIMIT=1 | ||
|
||
JWT_SECRET=5g1yk7pD9q3YL0iBEuUlPwOiWLj3I5tK+/rhHm+jgdE= | ||
JWT_REFRESH_SECRET=F2c8gag5nvqQkBOmOu5dWkK+gqZnjPUzHmx7S2tWkvs= | ||
PM2_FRONTEND=0 | ||
PM2_BACKEND=1 | ||
|
||
JWT_SECRET=5g1yk7pD9q3YL0iBEuUlPwOiWLj3I5tK+/rhHm+jgdE= | ||
JWT_REFRESH_SECRET=F2c8gag5nvqQkBOmOu5dWkK+gqZnjPUzHmx7S2tWkvs= |
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 @@ | ||
import { Request, Response } from "express"; | ||
|
||
export const restartPm2 = async ( | ||
req: Request, | ||
res: Response | ||
): Promise<Response> => { | ||
if (process.env.PM2_FRONTEND && process.env.PM2_BACKEND) { | ||
setTimeout(function () { | ||
const { execSync } = require("child_process"); | ||
execSync(`pm2 restart ${process.env.PM2_FRONTEND}`); | ||
execSync(`pm2 restart ${process.env.PM2_BACKEND}`); | ||
}, 100); | ||
return res.status(200).json({ status: "Reiniciando o Sistema" }); | ||
} | ||
return res | ||
.status(200) | ||
.json( | ||
"Erro falta Adicionar ao Arquivo .env do backend os parâmetros PM2_FRONTEND PM2_BACKEND" | ||
); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Router } from "express"; | ||
import isAuth from "../middleware/isAuth"; | ||
|
||
import * as sytemController from "../controllers/SystemController"; | ||
|
||
const systemRoutes = Router(); | ||
|
||
systemRoutes.post("/restartpm2", isAuth, sytemController.restartPm2); | ||
|
||
export default systemRoutes; |
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
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