Fix watching registration file before creation

This commit is contained in:
Cadence Ember
2026-05-12 14:11:06 +12:00
parent 678a1b77bb
commit 191a98e1dc
+8 -4
View File
@@ -78,10 +78,14 @@ function readRegistration() {
/** @type {import("../types").AppServiceRegistrationConfig} */ // @ts-ignore
let reg = readRegistration()
fs.watch(registrationFilePath, {persistent: false}, () => {
let newReg = readRegistration()
Object.assign(reg, newReg)
})
if (reg) {
fs.watch(registrationFilePath, {persistent: false}, () => {
let newReg = readRegistration()
if (newReg) {
Object.assign(reg, newReg)
}
})
}
module.exports.registrationFilePath = registrationFilePath
module.exports.readRegistration = readRegistration