admin sync fixes

This commit is contained in:
Ben Allfree 2024-01-13 22:52:30 +00:00
parent 6c370c13ee
commit 4a070eb09b

View File

@ -4,12 +4,19 @@ $app.onBeforeServe().add((e) => {
const log = mkLog(`admin-sync`) const log = mkLog(`admin-sync`)
const { id, email, tokenKey, passwordHash } = JSON.parse( const { id, email, tokenKey, passwordHash } = (() => {
$os.getenv(`ADMIN_SYNC`), try {
) return /** @type{{id:string, email:string, tokenKey:string,passwordHash:string}} */ (
JSON.parse($os.getenv(`ADMIN_SYNC`))
)
} catch (e) {
return { id: '', email: '', tokenKey: '', passwordHash: '' }
}
})()
if (!email) { if (!email) {
log(`Not active - skipped`) log(`Not active - skipped`)
return
} }
const result = new DynamicModel({ const result = new DynamicModel({