UNPKG

508 BPlain TextView Raw
1import { Presta } from './types'
2import { Env } from './constants'
3
4const defaultConfig = {
5 pid: process.pid,
6 cwd: process.cwd(),
7 env: Env.PRODUCTION,
8 debug: false,
9} as Presta
10
11export function setCurrentPrestaInstance(config: Presta): Presta {
12 // @ts-ignore
13 global.__presta__ = config
14 return config
15}
16
17export function getCurrentPrestaInstance(): Presta {
18 // @ts-ignore
19 if (!global.__presta__) {
20 setCurrentPrestaInstance(defaultConfig)
21 }
22
23 // @ts-ignore
24 return global.__presta__
25}