feat: udpate deno-commons-mod.ts
This commit is contained in:
@@ -37,8 +37,21 @@ export function isOn(val: string | undefined): boolean {
|
|||||||
lowerVal === "true";
|
lowerVal === "true";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getEnv(key: string): string {
|
||||||
|
const homeDir = getHomeDir();
|
||||||
|
if ((homeDir !== null) && key) {
|
||||||
|
const envValue = await readFileToString(
|
||||||
|
`${homeDir}/.config/envs/${key}`,
|
||||||
|
);
|
||||||
|
if (envValue !== null) {
|
||||||
|
return envValue.trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Deno.env.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
export function isEnvOn(envKey: string): boolean {
|
export function isEnvOn(envKey: string): boolean {
|
||||||
return isOn(Deno.env.get(envKey));
|
return isOn(getEnv(envKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatHumanTime(timeMillis: number): string {
|
export function formatHumanTime(timeMillis: number): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user