Hi,
can anyone advise why this code leaves me with config === undefined ?
class PagesAPIHandler extends APIHandler {
constructor(addonManager) {
super(addonManager, manifest.id);
addonManager.addAPIHandler(this);
let pages_db_location = '/home/pi/.mozilla-iot/pages'; // hard-coded fallback
const db = new Database(manifest.id);
db.open().then(() => {
db.loadConfig();
}).then((config) => {
if (config && config.dblocation) {
pages_db_location = config.dblocation;
} else {
console.error(`pages-api-handler (B): "dblocation" is not in extension configuration ${JSON.stringify(config)}`);
}
PagesDB.open(pages_db_location);
}).then(() => {
I’ve lightly edited from the actual code to remove some not relevant initialisation.
I just added the code to load the config and it is failing. With the fallback hard-coded location, the extension otherwise runs OK.