fix: URL not defined in migration

This commit is contained in:
Ben Allfree 2023-11-15 01:32:31 +00:00
parent 30ea41a28b
commit f49c7f1ce3

View File

@ -21,13 +21,14 @@ migrate(
if (!newValue || settings.meta[field] !== APP_DEFAULTS[field]) return if (!newValue || settings.meta[field] !== APP_DEFAULTS[field]) return
settings.meta[field] = newValue settings.meta[field] = newValue
} }
const { hostname } = new URL(PH_INSTANCE_URL)
fix(`appName`, PH_APP_NAME) fix(`appName`, PH_APP_NAME)
fix(`appUrl`, PH_INSTANCE_URL) fix(`appUrl`, PH_INSTANCE_URL)
fix(`senderName`, PH_APP_NAME) fix(`senderName`, PH_APP_NAME)
fix(`senderAddress`, `${PH_APP_NAME}@${hostname}`) fix(`senderAddress`, `${PH_APP_NAME}@app.pockethost.io`)
dao.saveSettings(settings) dao.saveSettings(settings)
console.error(`***defaults successfully applied`)
} catch (e) { } catch (e) {
console.error(`***error applying defaults: ${e}`) console.error(`***error applying defaults: ${e}`)
} }