Hi,
In Developing an extension - getting access to the core - #9 by chas_iot I mentioned I had problems loading config.
I have been chasing it down and can’t get it to work. As far as I can tell (and I would be delighted to be contradicted) the problem occurs in gateway-addon-note /lib/database.js or in the libraries it uses.
What I see is that the promise returns in the extension code before the config data is loaded from the database.
What I’ve done:
- Created the config related entries in manifest.json and tested that they work as I expect.
- Checked that the data appears in the gateway db.sqlite3
- added a few debug lines in lib/database.js
- The code in the problem area has not changed much since the original posting. It is available in github / pages-extension / testing branch
- After restarting the extension in the gateway, I see in the log
- what this shows is that the data is returned in database.js around 30ms after it is expected and tested in the extension code.
What have I done wrong?
Sorry about the screenshots. I would have preferred pre or block quote but it got horribly messed up, so I ended up with screenshots