mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 20:44:34 +00:00
use standard logger class in config.ts
This commit is contained in:
parent
47a81ba235
commit
43d975896a
1 changed files with 6 additions and 3 deletions
|
@ -9,6 +9,7 @@ import { dirname, resolve } from 'node:path';
|
|||
import * as yaml from 'js-yaml';
|
||||
import { globSync } from 'glob';
|
||||
import ipaddr from 'ipaddr.js';
|
||||
import Logger from './logger.js';
|
||||
import type * as Sentry from '@sentry/node';
|
||||
import type * as SentryVue from '@sentry/vue';
|
||||
import type { RedisOptions } from 'ioredis';
|
||||
|
@ -155,6 +156,8 @@ type Source = {
|
|||
}
|
||||
};
|
||||
|
||||
const configLogger = new Logger('config');
|
||||
|
||||
export type PrivateNetworkSource = string | { network?: string, ports?: number[] };
|
||||
|
||||
export type PrivateNetwork = {
|
||||
|
@ -192,7 +195,7 @@ export function parsePrivateNetworks(patterns: PrivateNetworkSource[] | undefine
|
|||
}
|
||||
}
|
||||
|
||||
console.warn('[config] Skipping invalid entry in allowedPrivateNetworks: ', e);
|
||||
configLogger.warn('Skipping invalid entry in allowedPrivateNetworks: ', e);
|
||||
return null;
|
||||
})
|
||||
.filter(p => p != null);
|
||||
|
@ -375,12 +378,12 @@ export function loadConfig(): Config {
|
|||
|
||||
if (configFiles.length === 0
|
||||
&& !process.env['MK_WARNED_ABOUT_CONFIG']) {
|
||||
console.log('No config files loaded, check if this is intentional');
|
||||
configLogger.warn('No config files loaded, check if this is intentional');
|
||||
process.env['MK_WARNED_ABOUT_CONFIG'] = '1';
|
||||
}
|
||||
|
||||
const config = configFiles.map(path => {
|
||||
console.log(`Reading configuration from ${path}`);
|
||||
configLogger.info(`Reading configuration from ${path}`);
|
||||
return fs.readFileSync(path, 'utf-8');
|
||||
})
|
||||
.map(contents => yaml.load(contents) as Source)
|
||||
|
|
Loading…
Add table
Reference in a new issue