mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-31 22:32:28 +00:00
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
27 lines
505 B
TypeScript
27 lines
505 B
TypeScript
import { Instance } from "../project/instance"
|
|
|
|
export namespace Env {
|
|
const state = Instance.state(() => {
|
|
return process.env as Record<string, string | undefined>
|
|
})
|
|
|
|
export function get(key: string) {
|
|
const env = state()
|
|
return env[key]
|
|
}
|
|
|
|
export function all() {
|
|
return state()
|
|
}
|
|
|
|
export function set(key: string, value: string) {
|
|
const env = state()
|
|
env[key] = value
|
|
}
|
|
|
|
export function remove(key: string) {
|
|
const env = state()
|
|
delete env[key]
|
|
}
|
|
}
|