hoodiehq / hoodie-server

:dog: Hapi plugin for Hoodie’s server core module
Apache License 2.0
243 stars 47 forks source link

assure folders before creating `hoodie-config` database #529

Closed gr2m closed 7 years ago

gr2m commented 7 years ago

This is a major problem, it currently breaks our quick start guide, the first-time experience for people who look into Hoodie for the first time.

The problem is in lib/config/index.js#L34: We try to create the hoodie-config database, before we assure that the folders exist in lib/config/index.js#L59. As Hoodie is using leveldb as the default database backend, it will try to create the .hoodie/data/hoodie-config folder, but fails because .hoodie/data does not yet exist at this point.

We don’t need state.db.config before getSecret. What I would suggest to do is to move state.db.config = new config.PouchDB('hoodie-config').doc('hoodie') into its own task and run it as part of the series after assure folders.