feat(serverdata): all server info will be in all servers now for reduncay
This commit is contained in:
344
server/services/server/utils/serverData.json
Normal file
344
server/services/server/utils/serverData.json
Normal file
@@ -0,0 +1,344 @@
|
||||
{
|
||||
"servers": [
|
||||
{
|
||||
"sName": "test",
|
||||
"serverDNS": "usmcd1vms036",
|
||||
"plantToken": "test3",
|
||||
"idAdress": "10.193.0.56",
|
||||
"greatPlainsPlantCode": "1",
|
||||
"streetAddress": "289 GA-155 S",
|
||||
"cityState": "McDonough, GA",
|
||||
"zipcode": "30253",
|
||||
"contactEmail": "noreply@alpla.com",
|
||||
"contactPhone": "770-914-1407",
|
||||
"customerTiAcc": "ALPLA01INTGROUP",
|
||||
"lstServerPort": "4000",
|
||||
"active": true,
|
||||
"serverLoc": "E:\\LST\\lstv2",
|
||||
"oldVersion": "E:\\LST\\lst_backend",
|
||||
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
|
||||
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
|
||||
"otherSettings": [{"specialInstructions": "something for ti"}]
|
||||
},
|
||||
{
|
||||
"sName": "Bethlehem",
|
||||
"serverDNS": "usbet1vms006",
|
||||
"plantToken": "usbet1",
|
||||
"idAddress": "10.204.0.26",
|
||||
"greatPlainsPlantCode": "75",
|
||||
"streetAddress": "2120 Spillman Dr",
|
||||
"cityState": "Bethlehem, PA",
|
||||
"zipcode": "18015",
|
||||
"contactEmail": "blake.matthes@alpla.com",
|
||||
"contactPhone": "6366970253",
|
||||
"customerTiAcc": "ALPL01BETHINT",
|
||||
"lstServerPort": "4000",
|
||||
"active": false,
|
||||
"serverLoc": "E:\\LST\\lstv2",
|
||||
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend",
|
||||
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
|
||||
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
|
||||
"otherSettings": [{"specialInstructions": "something for ti"}]
|
||||
},
|
||||
{
|
||||
"sName": "Huston",
|
||||
"serverDNS": "ushou1vms006",
|
||||
"plantToken": "ushou1",
|
||||
"idAddress": "10.195.0.26",
|
||||
"greatPlainsPlantCode": "20",
|
||||
"streetAddress": "5800 Armour Dr",
|
||||
"cityState": "Houston, TX",
|
||||
"zipcode": "77020",
|
||||
"contactEmail": "blake.matthes@alpla.com",
|
||||
"contactPhone": "6366970253",
|
||||
"customerTiAcc": "ALPL01HOUSINT",
|
||||
"lstServerPort": "4000",
|
||||
"active": false,
|
||||
"serverLoc": "E:\\LST\\lstv2",
|
||||
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend",
|
||||
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
|
||||
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
|
||||
"otherSettings": [{"specialInstructions": "something for ti"}]
|
||||
},
|
||||
{
|
||||
"sName": "Bowling Green 1",
|
||||
"serverDNS": "usbow1vms006",
|
||||
"plantToken": "usbow1",
|
||||
"idAddress": "10.25.0.26",
|
||||
"greatPlainsPlantCode": "55",
|
||||
"streetAddress": "215 Technology Way",
|
||||
"cityState": "Bowling Green, KY",
|
||||
"zipcode": "42101",
|
||||
"contactEmail": "blake.matthes@alpla.com",
|
||||
"contactPhone": "6366970253",
|
||||
"customerTiAcc": "ALPL01BG1INT",
|
||||
"lstServerPort": "4000",
|
||||
"active": true,
|
||||
"serverLoc": "E:\\LST\\lstv2",
|
||||
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend",
|
||||
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
|
||||
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
|
||||
"otherSettings": [{"specialInstructions": "something for ti"}]
|
||||
},
|
||||
{
|
||||
"sName": "Iowa ISBM",
|
||||
"serverDNS": "usiow1vms006",
|
||||
"plantToken": "usiow2",
|
||||
"idAddress": "10.75.0.26",
|
||||
"greatPlainsPlantCode": "31",
|
||||
"streetAddress": "2309 Heinz Rd",
|
||||
"cityState": "Iowa CIty, IA",
|
||||
"zipcode": "52240",
|
||||
"contactEmail": "blake.matthes@alpla.com",
|
||||
"contactPhone": "6366970253",
|
||||
"customerTiAcc": "ALPL01IA2INT",
|
||||
"lstServerPort": "4001",
|
||||
"active": false,
|
||||
"serverLoc": "E:\\LST\\lstv2",
|
||||
"oldVersion": "D:\\lst\\lst_backend_2",
|
||||
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
|
||||
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
|
||||
"otherSettings": [{"specialInstructions": "something for ti"}]
|
||||
},
|
||||
{
|
||||
"sName": "Kansas City",
|
||||
"serverDNS": "usksc1vms006",
|
||||
"plantToken": "usksc1",
|
||||
"idAddress": "10.42.9.26",
|
||||
"greatPlainsPlantCode": "85",
|
||||
"streetAddress": "1800 E 94th St Suite 300",
|
||||
"cityState": "Kansas City, MO",
|
||||
"zipcode": "64131",
|
||||
"contactEmail": "blake.matthes@alpla.com",
|
||||
"contactPhone": "6366970253",
|
||||
"customerTiAcc": "ALPL01KCINT",
|
||||
"lstServerPort": "4000",
|
||||
"active": false,
|
||||
"serverLoc": "E:\\LST\\lstv2",
|
||||
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend",
|
||||
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
|
||||
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
|
||||
"otherSettings": [{"specialInstructions": "something for ti"}]
|
||||
},
|
||||
{
|
||||
"sName": "Bowling Green 2",
|
||||
"serverDNS": "usbow2vms006",
|
||||
"plantToken": "usbow2",
|
||||
"idAddress": "10.106.0.26",
|
||||
"greatPlainsPlantCode": "56",
|
||||
"streetAddress": "377 Southwood Ct",
|
||||
"cityState": "Bowling Green, KY",
|
||||
"zipcode": "42101",
|
||||
"contactEmail": "blake.matthes@alpla.com",
|
||||
"contactPhone": "6366970253",
|
||||
"customerTiAcc": "ALPL01BG2INT",
|
||||
"lstServerPort": "4000",
|
||||
"active": false,
|
||||
"serverLoc": "E:\\LST\\lstv2",
|
||||
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend",
|
||||
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
|
||||
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
|
||||
"otherSettings": [{"specialInstructions": "something for ti"}]
|
||||
},
|
||||
{
|
||||
"sName": "MCDonough",
|
||||
"serverDNS": "usmcd1vms006",
|
||||
"plantToken": "usmcd1",
|
||||
"idAddress": "10.193.0.26",
|
||||
"greatPlainsPlantCode": "10",
|
||||
"streetAddress": "289 GA-155 S",
|
||||
"cityState": "McDonough, GA",
|
||||
"zipcode": "30253",
|
||||
"contactEmail": "blake.matthes@alpla.com",
|
||||
"contactPhone": "6366970253",
|
||||
"customerTiAcc": "ALPL01MCDINT",
|
||||
"lstServerPort": "4000",
|
||||
"active": true,
|
||||
"serverLoc": "E:\\LST\\lstv2",
|
||||
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend",
|
||||
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
|
||||
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
|
||||
"otherSettings": [{"specialInstructions": "something for ti"}]
|
||||
},
|
||||
{
|
||||
"sName": "Dayton",
|
||||
"serverDNS": "usday1vms006",
|
||||
"plantToken": "usday1",
|
||||
"idAddress": "10.44.0.26",
|
||||
"greatPlainsPlantCode": "80",
|
||||
"streetAddress": "2700 Concorde Dr Suite 200",
|
||||
"cityState": "Vandalia, OH",
|
||||
"zipcode": "45377",
|
||||
"contactEmail": "blake.matthes@alpla.com",
|
||||
"contactPhone": "6366970253",
|
||||
"customerTiAcc": "ALPL01DAYTONINT",
|
||||
"lstServerPort": "4000",
|
||||
"active": false,
|
||||
"serverLoc": "E:\\LST\\lstv2",
|
||||
"oldVersion": "E:\\LST\\lst_backend",
|
||||
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
|
||||
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
|
||||
"otherSettings": [{"specialInstructions": "something for ti"}]
|
||||
},
|
||||
{
|
||||
"sName": "Salt Lake City",
|
||||
"serverDNS": "usslc1vms006",
|
||||
"plantToken": "usslc1",
|
||||
"idAddress": "10.202.0.26",
|
||||
"greatPlainsPlantCode": "70",
|
||||
"streetAddress": "4324 Commercial Way Suite A",
|
||||
"cityState": "Salt Lake City, UT",
|
||||
"zipcode": "84104",
|
||||
"contactEmail": "blake.matthes@alpla.com",
|
||||
"contactPhone": "6366970253",
|
||||
"customerTiAcc": "ALPL01SLCINT",
|
||||
"lstServerPort": "4000",
|
||||
"active": false,
|
||||
"serverLoc": "E:\\LST\\lstv2",
|
||||
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend",
|
||||
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
|
||||
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
|
||||
"otherSettings": [{"specialInstructions": "something for ti"}]
|
||||
},
|
||||
{
|
||||
"sName": "Lima",
|
||||
"serverDNS": "uslim1vms006",
|
||||
"plantToken": "uslim1",
|
||||
"idAddress": "10.53.0.26",
|
||||
"greatPlainsPlantCode": "50",
|
||||
"streetAddress": "3320 Fort Shawnee Industrial Dr",
|
||||
"cityState": "Lima, OH",
|
||||
"zipcode": "45806",
|
||||
"contactEmail": "blake.matthes@alpla.com",
|
||||
"contactPhone": "6366970253",
|
||||
"customerTiAcc": "ALPL01LIMAINT",
|
||||
"lstServerPort": "4000",
|
||||
"active": false,
|
||||
"serverLoc": "E:\\LST\\lstv2",
|
||||
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend",
|
||||
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
|
||||
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
|
||||
"otherSettings": [{"specialInstructions": "something for ti"}]
|
||||
},
|
||||
{
|
||||
"sName": "Florence",
|
||||
"serverDNS": "usflo1vms006",
|
||||
"plantToken": "usflo1",
|
||||
"idAddress": "10.203.0.26",
|
||||
"greatPlainsPlantCode": "22",
|
||||
"streetAddress": "7080 New Buffington Rd",
|
||||
"cityState": "Florence, KY",
|
||||
"zipcode": "41042",
|
||||
"contactEmail": "blake.matthes@alpla.com",
|
||||
"contactPhone": "6366970253",
|
||||
"customerTiAcc": "ALPL01FLORINT",
|
||||
"lstServerPort": "4000",
|
||||
"active": false,
|
||||
"serverLoc": "E:\\LST\\lstv2",
|
||||
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend",
|
||||
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
|
||||
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
|
||||
"otherSettings": [{"specialInstructions": "something for ti"}]
|
||||
},
|
||||
{
|
||||
"sName": "Iowa EBM",
|
||||
"serverDNS": "usiow1vms006",
|
||||
"plantToken": "usiow1",
|
||||
"idAddress": "10.75.0.26",
|
||||
"greatPlainsPlantCode": "30",
|
||||
"streetAddress": "2258 Heinz Rd",
|
||||
"cityState": "Iowa CIty, IA",
|
||||
"zipcode": "52240",
|
||||
"contactEmail": "blake.matthes@alpla.com",
|
||||
"contactPhone": "6366970253",
|
||||
"customerTiAcc": "ALPL01IA1INT",
|
||||
"lstServerPort": "4000",
|
||||
"active": false,
|
||||
"serverLoc": "E:\\LST\\lstv2",
|
||||
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend",
|
||||
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
|
||||
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
|
||||
"otherSettings": [{"specialInstructions": "something for ti"}]
|
||||
},
|
||||
{
|
||||
"sName": "Jefferson city",
|
||||
"serverDNS": "usjci1vms006",
|
||||
"plantToken": "usjci1",
|
||||
"idAddress": "10.167.0.26",
|
||||
"greatPlainsPlantCode": "40",
|
||||
"streetAddress": "2662 Militia Dr",
|
||||
"cityState": "Jefferson City, MO",
|
||||
"zipcode": "65101",
|
||||
"contactEmail": "blake.matthes@alpla.com",
|
||||
"contactPhone": "6366970253",
|
||||
"customerTiAcc": "ALPL01JCINT",
|
||||
"lstServerPort": "4000",
|
||||
"active": false,
|
||||
"serverLoc": "E:\\LST\\lstv2",
|
||||
"oldVersion": "D:\\LST\\lst_backend",
|
||||
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
|
||||
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
|
||||
"otherSettings": [{"specialInstructions": "something for ti"}]
|
||||
},
|
||||
{
|
||||
"sName": "Sherman",
|
||||
"serverDNS": "usshe1vms006",
|
||||
"plantToken": "usshe1",
|
||||
"idAddress": "10.205.0.26",
|
||||
"greatPlainsPlantCode": "21",
|
||||
"streetAddress": "4000 Howe Dr",
|
||||
"cityState": "Sherman, TX",
|
||||
"zipcode": "75092",
|
||||
"contactEmail": "blake.matthes@alpla.com",
|
||||
"contactPhone": "6366970253",
|
||||
"customerTiAcc": "ALPL01SHERMANINT",
|
||||
"lstServerPort": "4000",
|
||||
"active": false,
|
||||
"serverLoc": "E:\\LST\\lstv2",
|
||||
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend",
|
||||
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
|
||||
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
|
||||
"otherSettings": [{"specialInstructions": "something for ti"}]
|
||||
},
|
||||
{
|
||||
"sName": "West Bend",
|
||||
"serverDNS": "usweb1vms006",
|
||||
"plantToken": "usweb1",
|
||||
"idAddress": "10.80.0.26",
|
||||
"greatPlainsPlantCode": "65",
|
||||
"streetAddress": "825 Rail Way",
|
||||
"cityState": "West Bend, WI",
|
||||
"zipcode": "53095",
|
||||
"contactEmail": "blake.matthes@alpla.com",
|
||||
"contactPhone": "6366970253",
|
||||
"customerTiAcc": "ALPL01WBINT",
|
||||
"lstServerPort": "4000",
|
||||
"active": false,
|
||||
"serverLoc": "E:\\LST\\lstv2",
|
||||
"oldVersion": "C:\\Users\\adm_matthes01\\Desktop\\lst_backend",
|
||||
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
|
||||
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
|
||||
"otherSettings": [{"specialInstructions": "something for ti", "active": false}]
|
||||
},
|
||||
{
|
||||
"sName": "St Peters",
|
||||
"serverDNS": "usstp1vms006",
|
||||
"plantToken": "usstp1",
|
||||
"idAddress": "10.37.0.26",
|
||||
"greatPlainsPlantCode": "45",
|
||||
"streetAddress": "9 Cermak Blvd",
|
||||
"cityState": "St Peters, MO",
|
||||
"zipcode": "63376",
|
||||
"contactEmail": "blake.matthes@alpla.com",
|
||||
"contactPhone": "6366970253",
|
||||
"customerTiAcc": "ALPL01STPINT",
|
||||
"lstServerPort": "4000",
|
||||
"active": false,
|
||||
"serverLoc": "E:\\LST\\lstv2",
|
||||
"oldVersion": "E:\\LST\\lst_backend",
|
||||
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
|
||||
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
|
||||
"otherSettings": [{"specialInstructions": "something for ti"}]
|
||||
}
|
||||
]
|
||||
}
|
||||
51
server/services/server/utils/serverData.ts
Normal file
51
server/services/server/utils/serverData.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
// This will help maintain the server db so when we run an update it will show up here all the time.
|
||||
// kinda bad too but this will help us keep the db identical.
|
||||
|
||||
import {db} from "../../../../database/dbclient.js";
|
||||
import {serverData} from "../../../../database/schema/serverData.js";
|
||||
import {createLog} from "../../logger/logger.js";
|
||||
import fs from "fs";
|
||||
|
||||
export const serversCheckPoint = async () => {
|
||||
let servers: any;
|
||||
fs.readFile("./data.json", "utf8", (err, data) => {
|
||||
if (err) {
|
||||
console.error("Error reading JSON file:", err);
|
||||
return;
|
||||
}
|
||||
servers = JSON.parse(data);
|
||||
});
|
||||
|
||||
// get the roles
|
||||
try {
|
||||
const settingsCheck = await db.select().from(serverData);
|
||||
|
||||
try {
|
||||
for (let i = 0; i < servers.length; i++) {
|
||||
const newRole = await db
|
||||
.insert(serverData)
|
||||
.values(servers[i])
|
||||
.onConflictDoUpdate({
|
||||
target: serverData.plantToken,
|
||||
set: {
|
||||
sName: servers[i].sName,
|
||||
serverDNS: servers[i].serverDNS,
|
||||
active: servers[i].active,
|
||||
contactEmail: servers[i].contactEmail,
|
||||
contactPhone: servers[i].contactPhone,
|
||||
shippingHours: servers[i].shippingHours,
|
||||
customerTiAcc: servers[i].customerTiAcc,
|
||||
tiPostTime: servers[i].tiPostTime,
|
||||
otherSettings: servers[i].otherSettings,
|
||||
},
|
||||
}) // this will only update the ones that are new :D
|
||||
.returning({name: serverData.sName});
|
||||
}
|
||||
createLog("info", "lst", "server", "Servers were just added/updated due to server startup");
|
||||
} catch (error) {
|
||||
createLog("error", "lst", "server", `There was an error adding serverData to the db, ${error}`);
|
||||
}
|
||||
} catch (error) {
|
||||
createLog("error", "lst", "server", `There was an error adding serverData to the db, ${error}`);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user