Skip to content

Default config for fileDB contains unused properties #1288

@kriswest

Description

@kriswest

Describe the bug
The default config for includes properties that the fileDB implementation doesn't use:

"params": {
"filepath": "./."
},

The filePath is never read and the DB files are always created at the same path, e.g.:

// these don't get coverage in tests as they have already been run once before the test
/* istanbul ignore if */
if (!fs.existsSync('./.data')) fs.mkdirSync('./.data');
/* istanbul ignore if */
if (!fs.existsSync('./.data/db')) fs.mkdirSync('./.data/db');

The MongoDB client uses options for additional settings, rather than params. Hence, I believe params is always unused and should be removed from the config schema and from the default config:

"database": {
"type": "object",
"properties": {
"type": { "type": "string" },
"enabled": { "type": "boolean" },
"connectionString": { "type": "string" },
"options": { "type": "object" },
"params": { "type": "object" }
},
"required": ["type", "enabled"]
},

Were we to introduce a working option for setting the path to the database files, we should use the options element (as the mongo version does) and add details to the JSON schema to govern the settings for the different types correctly. I don't propose to do that at the moment - rather to just cleanup the unused params element.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions