feature: add support for setting an FSDB_ROOT environment variable
This commit is contained in:
parent
e44ee48eaa
commit
bf2bec0c3d
2 changed files with 2 additions and 16 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@andyburke/fsdb",
|
||||
"version": "0.3.0",
|
||||
"version": "0.4.0",
|
||||
"license": "MIT",
|
||||
"exports": {
|
||||
".": "./fsdb.ts",
|
||||
|
|
16
fsdb.ts
16
fsdb.ts
|
@ -34,7 +34,7 @@ export class FSDB_COLLECTION<T extends Record<string, any>> {
|
|||
...{
|
||||
id_field: 'id',
|
||||
organize: by_lurid,
|
||||
root: `./.fsdb/${input_config?.name ?? 'unknown'}`
|
||||
root: `${Deno.env.get('FSDB_ROOT') ?? './fsdb'}/${input_config?.name ?? 'unknown'}`
|
||||
},
|
||||
...(input_config ?? {})
|
||||
};
|
||||
|
@ -214,20 +214,6 @@ export class FSDB_COLLECTION<T extends Record<string, any>> {
|
|||
const results: T[] = [];
|
||||
const item_paths: string[] = [];
|
||||
|
||||
// for each key in the search
|
||||
// see if we have an index for it
|
||||
// if we have an index, use that index to put any search path right at the beginning of the list
|
||||
//
|
||||
// once we have a list of items to search
|
||||
// apply offset
|
||||
// for each item, load it
|
||||
// let matched = false;
|
||||
// for each key in search
|
||||
// if the item matches this key/value, matched = true; break;
|
||||
// if limit reached, break;
|
||||
//
|
||||
// return matched items
|
||||
|
||||
for (const search_key of Object.keys(criteria)) {
|
||||
const indexer_for_search_key: FSDB_INDEXER<T> | undefined = this.INDEX[search_key];
|
||||
const value: string = criteria[search_key];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue