diff options
author | Raphael <mail@raphaelkabo.com> | 2023-05-13 19:24:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-13 19:24:13 +0100 |
commit | 3ec47e9c512ebf7432a4fa139bc0478f9ba98d3b (patch) | |
tree | a54618c5dc9f84a8ba06f9c8c33d244f5f26f779 /src/helpers.js | |
parent | f1a5a9b9a0f8357e25e3b2c8d72d745093bda9c3 (diff) | |
parent | 365398359f2d80345a61f76f3ecf0fd6eb9bdde6 (diff) |
Merge pull request #98 from lowercasename/rk/new-config
TOML config library and migration from CommonJS to ES modules
Diffstat (limited to 'src/helpers.js')
-rw-r--r-- | src/helpers.js | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/helpers.js b/src/helpers.js index 9b7559f..305187f 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -1,14 +1,14 @@ -const domain = require("./config/domain.js").domain; -const siteName = require("./config/domain.js").sitename; - -const mongoose = require("mongoose"); -const Log = mongoose.model("Log"); -var moment = require("moment-timezone"); -const icalGenerator = require("ical-generator"); +import moment from "moment-timezone"; +import icalGenerator from "ical-generator"; +import Log from "./models/Log.js"; +import { getConfig } from "./lib/config.js"; +const config = getConfig(); +const domain = config.general.domain; +const siteName = config.general.site_name; // LOGGING -function addToLog(process, status, message) { +export function addToLog(process, status, message) { let logEntry = new Log({ status: status, process: process, @@ -20,7 +20,7 @@ function addToLog(process, status, message) { }); } -function exportIcal(events, calendarName) { +export function exportIcal(events, calendarName) { // Create a new icalGenerator... generator const cal = icalGenerator({ name: calendarName || siteName, @@ -52,8 +52,3 @@ function exportIcal(events, calendarName) { const string = cal.toString(); return string; } - -module.exports = { - addToLog, - exportIcal, -}; |