fix config

This commit is contained in:
AlfandiMario
2024-11-20 15:37:08 +07:00
parent 557cac861d
commit 1ae1fd8f8a
7 changed files with 33 additions and 12 deletions

1
.gitignore vendored
View File

@@ -2,4 +2,5 @@ build
node_modules
config-meshbio.json
xbuild
dist
xtmp

View File

@@ -4,7 +4,7 @@ Sample config file
"base_url": "https://cpone.aplikasi.web.id/one-api/",
// Setiap 2 menit dari jam 6 sampai 20
"schedule": [
"0 */2 6-20 * *"
"*/2 6-20 * * *"
],
"delay": 5,
"row_per_batch": 50,

View File

@@ -1,7 +1,7 @@
{
"base_url": "https://cpone.aplikasi.web.id/one-api/",
"base_url": "https://devluar.aplikasi.web.id/one-api/",
"schedule": [
"0 */2 6-20 * *"
"*/2 6-20 * * *"
],
"delay": 5,
"row_per_batch": 50,

6
dist/gw-wa.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -7,7 +7,7 @@
"build": "rimraf build/ && prettier --write source/ && tsc",
"compile": "cross-env NODE_OPTIONS=--openssl-legacy-provider ncc build build/server.js -m -o dist && move dist\\index.js dist\\gw-wa.js",
"start": "node ./dist/gw-wa.js",
"bcs": "rimraf build/ && prettier --write source/ && tsc && cross-env NODE_OPTIONS=--openssl-legacy-provider ncc build build/server.js -m -o dist && move dist\\index.js dist\\one-point-member-gw.js && node ./dist/one-point-member-gw.js"
"bcs": "rimraf build/ && prettier --write source/ && tsc && cross-env NODE_OPTIONS=--openssl-legacy-provider ncc build build/server.js -m -o dist && move dist\\index.js dist\\gw-wa.js && node ./dist/gw-wa.js"
},
"keywords": [],
"author": "",

View File

@@ -7,11 +7,8 @@ interface IConfig {
row_per_batch: number;
startDate: string;
endDate: string;
mcuID: string;
}
const j_config = JSON.parse(
readFileSync("./config-point-member.json").toString()
);
const j_config = JSON.parse(readFileSync("./config-gw-wa.json").toString());
const config: IConfig = {
base_url: j_config["base_url"],
@@ -20,6 +17,5 @@ const config: IConfig = {
row_per_batch: j_config["row_per_batch"],
startDate: j_config["startDate"],
endDate: j_config["endDate"],
mcuID: j_config["mcuID"],
};
export default config;

View File

@@ -253,3 +253,27 @@ async function delay(ms: number) {
function elseif(arg0: boolean) {
throw new Error("Function not implemented.");
}
for (const sched of config.schedule) {
Xcron.schedule(
sched,
async () => {
logging.info(
NAME_SPACE,
" -------------------- ON INIT SCHEDULE --------------------"
);
await main("N");
await main("E");
await main("R");
logging.info(
NAME_SPACE,
"-------------------- END SCHEDULE--------------------"
);
},
{
timezone: "Asia/Jakarta",
}
);
}