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