/** * If we are running in client mode we want to periodically check the SERVER_NAME for new/updates queries * this will be on a cronner job, we will check 2 times a day for new data, we will also have a route we can trigger to check this manually incase we have * queries we make for one plant but will eventually go to all plants. * in client mode we will not be able to add, update, or delete, or push updates * * if we are running on server mode we will provide all queries. * when pushing to another server we will allow all or just a single server by plant token. * allow for new queries to be added * allow for queries to be updated by id * table will be * id * name * description * query * version * active * options (string ie start,end) * add_date * add_user * upd_date * upd_user * * if we are running in localhost or dev or just someone running the server on there computer but using localhost we will allow to push to the main server the SERVER_NAME in the env should point to the main server * that way when we check if we are in production we will know. * the node env must also be set non production in order to push to the main server. * we will also be able to do all the same as the server mode but the push here will just go to the main server. */ // doing the client stuff first // ┌──────────────── (optional) second (0 - 59) // │ ┌────────────── minute (0 - 59) // │ │ ┌──────────── hour (0 - 23) // │ │ │ ┌────────── day of month (1 - 31) // │ │ │ │ ┌──────── month (1 - 12, JAN-DEC) // │ │ │ │ │ ┌────── day of week (0 - 6, SUN-Mon) // │ │ │ │ │ │ (0 to 6 are Sunday to Saturday; 7 is Sunday, the same as 0) // │ │ │ │ │ │ // * * * * * * if (process.env.NODE_ENV?.trim() === "production") { // setup cronner let cronTime = "* 5 * * * *"; if (process.env.QUERY_TIME_TYPE === "m") { // will run this cron ever x cronTime = `* ${process.env.QUERY_CHECK} * * * *`; } if (process.env.QUERY_TIME_TYPE === "h") { // will run this cron ever x cronTime = `* * ${process.env.QUERY_CHECK} * * * `; } if (process.env.QUERY_TIME_TYPE === "d") { // will run this cron ever x cronTime = `* * * * * ${process.env.QUERY_CHECK}`; } console.info(cronTime); }