Migrate from DSB Mobile to BOLLE

This commit is contained in:
2023-06-02 21:15:52 +02:00
parent d3b1bacacd
commit 0b9c8a5552

View File

@ -11,12 +11,16 @@ import {
} from "./api/index.js";
import auth from "./api/auth.js";
import { Parser } from "./parser/index.js";
import { DSBClient } from "./parser/dsbmobile.js";
import { BolleClient } from "./parser/bolle.js";
import { parseSubstitutionPlan } from "./parser/untis.js";
// Check DSB Mobile credentials are supplied
if (!process.env.DSB_USER || !process.env.DSB_PASSWORD) {
console.error("Error: DSB Auth environment variables missing!");
// Check that credentials are supplied
if (
!process.env.BOLLE_URL ||
!process.env.BOLLE_USER ||
!process.env.BOLLE_KEY
) {
console.error("Error: Bolle Auth environment variables missing!");
process.exit(1);
}
@ -30,7 +34,11 @@ app.use(express.urlencoded({ extended: true }));
// Initialize the Parser and set it to update the
// substitution plan at the specified update interval
new Parser(
new DSBClient(process.env.DSB_USER, process.env.DSB_PASSWORD),
new BolleClient(
process.env.BOLLE_URL,
process.env.BOLLE_USER,
process.env.BOLLE_KEY
),
parseSubstitutionPlan,
process.env.UPDATE_INTERVAL || 1 * 60 * 1000 // Default to 1 minute
);