🎨 Make the parser modular
- Move some DSB related functions from parser/index to parser/dsbmobile - Make the dsb parser a fileProvider with the DSBClient class - Initialize the parser with a fileProvider and documentParser instance
This commit is contained in:
@ -11,6 +11,8 @@ import {
|
||||
} from "./api/index.js";
|
||||
import auth from "./api/auth.js";
|
||||
import { Parser } from "./parser/index.js";
|
||||
import { DSBClient } from "./parser/dsbmobile.js";
|
||||
import { parseSubstitutionPlan } from "./parser/untis.js";
|
||||
|
||||
// Check DSB Mobile credentials are supplied
|
||||
if (!process.env.DSB_USER || !process.env.DSB_PASSWORD) {
|
||||
@ -28,8 +30,8 @@ app.use(express.urlencoded({ extended: true }));
|
||||
// Initialize the Parser and set it to update the
|
||||
// substitution plan at the specified update interval
|
||||
new Parser(
|
||||
process.env.DSB_USER,
|
||||
process.env.DSB_PASSWORD,
|
||||
new DSBClient(process.env.DSB_USER, process.env.DSB_PASSWORD),
|
||||
parseSubstitutionPlan,
|
||||
process.env.UPDATE_INTERVAL || 1 * 60 * 1000 // Default to 1 minute
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user