fix: throw error if config import fails

feat: log used config in backend
This commit is contained in:
2023-12-12 14:37:24 +01:00
parent 848fde4660
commit 859763367e
3 changed files with 27 additions and 30 deletions
@@ -11,13 +11,13 @@
*
* To get more information about the meaning of specific fields, please use your IDE to read the TSDoc documentation.
*
* @type {import('../../src/storage/elasticsearch/types/elasticsearch-config.js')}
* @type {import('../../src/storage/elasticsearch/types/elasticsearch-config.js').ElasticsearchConfigFile}
*/
const config = {
internal: {
database: {
name: 'elasticsearch',
version: '5.6',
version: '8.4.2',
query: {
minMatch: '75%',
queryType: 'dis_max',
@@ -1,5 +1,7 @@
// @ts-check
import {readFile, readdir} from 'fs/promises';
import url from 'url';
import path from 'path';
/**
* @example version(1, import.meta.url)
@@ -27,10 +29,10 @@ export async function version(options, base) {
* @returns {Promise<import('@openstapps/core').SCAppVersionInfo[]>}
*/
export async function versions(base) {
const directory = await readdir(new URL(base));
const versions = [...new Set(directory.map(it => it.replace(/\.\w+\.md$/, '')))].sort(
(a, b) => -a.localeCompare(b, undefined, {numeric: true}),
);
const directory = await readdir(path.dirname(url.fileURLToPath(base)));
const versions = [
...new Set(directory.filter(it => it.endsWith('.md')).map(it => it.replace(/\.\w+\.md$/, ''))),
].sort((a, b) => -a.localeCompare(b, undefined, {numeric: true}));
return Promise.all(versions.map(versionName => version({version: versionName}, base)));
}