42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
const { execSync } = require("child_process");
|
|
const os = require("os");
|
|
const nodemon = require("nodemon");
|
|
const { resolve } = require("path");
|
|
/** @type {nodemon.Settings} */
|
|
const NodemonConfig = {
|
|
delay: 2500,
|
|
signal: "SIGILL",
|
|
watch: [
|
|
"./src/**/*",
|
|
"./Dockerfile",
|
|
"./docker-compose.yaml",
|
|
"./package*.json"
|
|
],
|
|
ignore: [
|
|
"./src/api/basic_ui/html/**/*"
|
|
],
|
|
ext: "js,ts,json",
|
|
env: {
|
|
MongoDB_URL: "mongodb://127.0.0.1:27017",
|
|
NODE_ENV: "development",
|
|
COOKIE_SECRET: "OFVpServer",
|
|
START_OPENSSH: "1",
|
|
START_WIREGUARD: "1",
|
|
DEBIAN_FRONTEND: "noninteractive"
|
|
}
|
|
};
|
|
if (process.argv.includes("--docker")) NodemonConfig.exec = "docker-compose up --build -d ofvp_server && docker logs --follow ofvp_server";
|
|
else {
|
|
NodemonConfig.script = resolve(__dirname, "./src/index.js");
|
|
NodemonConfig.nodeArgs = [
|
|
"--trace-warnings"
|
|
];
|
|
}
|
|
if (NodemonConfig.exec === undefined) {
|
|
if (os.userInfo().uid !== 0) {
|
|
console.log("Runwith sudo or admin");
|
|
process.exit(1);
|
|
}
|
|
}
|
|
console.log(NodemonConfig);
|
|
nodemon(NodemonConfig) |