Fix db wipe on json error and default config checking
Firstly, because of how the db was loaded, it would create a new one on any error. This can be an issue if the json is invalid at all. It now exits on a json error to avoid wiping the db and creates a new one on a missing file error.
Secondly, the AP_CONFIG variable would only drop back to defaults if the whole ap section was missing. I figured it would be a good idea to provide defaults for everyting in init just so it wouldn't have to be done anywhere else again in the future.