feat(pockethost): expose logSettings

This commit is contained in:
Ben Allfree 2024-06-27 13:58:48 -07:00
parent 589f8c00c3
commit 737b4b855a
4 changed files with 15 additions and 8 deletions

View File

@ -0,0 +1,5 @@
---
'pockethost': minor
---
logSettings now exported from core

View File

@ -1,4 +1,3 @@
import { forEach } from '@s-libs/micro-dash'
import { config } from 'dotenv'
import envPaths from 'env-paths'
import { dirname, join } from 'path'
@ -8,6 +7,7 @@ import { mkBoolean, mkCsvString, mkNumber, mkPath, mkString } from '../core'
import { InstanceId } from './common'
import { DEBUG, IS_DEV } from './common/debug'
import { Settings } from './core/Settings'
import { logSettings } from './core/logSettings'
const __dirname = dirname(fileURLToPath(import.meta.url))
@ -58,12 +58,6 @@ export const NODE_ENV = () => process.env.NODE_ENV
export const INSTANCE_DATA_DIR = (id: InstanceId, ...paths: string[]) =>
join(DATA_DIR(), id, ...paths)
export const logConstants = () => {
forEach(settings, (v, k) => {
console.log(`${k}: ${v}`)
})
}
if (DEBUG()) {
logConstants()
logSettings(settings)
}

View File

@ -3,5 +3,6 @@ export * from './Settings'
export * from './asyncExecutionGuard'
export * from './exit'
export * from './internal'
export * from './logSettings'
export * from './smartFetch'
export * from './tryFetch'

View File

@ -0,0 +1,7 @@
import { forEach } from '@s-libs/micro-dash'
export const logSettings = (settings: { [_: string]: any }) => {
forEach(settings, (v, k) => {
console.log(`${k}: ${v}`)
})
}