mirror of
https://github.com/pockethost/pockethost.git
synced 2025-07-02 02:42:30 +00:00
chore: fix env.ts typing
This commit is contained in:
parent
2a9e69f26c
commit
e62f8c1214
@ -6,15 +6,19 @@ import { boolean } from 'boolean'
|
|||||||
import UrlPattern from 'url-pattern'
|
import UrlPattern from 'url-pattern'
|
||||||
import base from '../../../package.json'
|
import base from '../../../package.json'
|
||||||
|
|
||||||
export const env = (name: string, _default: string = '') => {
|
export type PublicEnvName = `PUBLIC_${string}`
|
||||||
|
|
||||||
|
export const env = (name: PublicEnvName, _default: string = '') => {
|
||||||
const v = _env[name]
|
const v = _env[name]
|
||||||
if (!v) return _default
|
if (!v) return _default
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
export const envi = (name: string, _default: number) => parseInt(env(name, _default.toString()))
|
export const envi = (name: PublicEnvName, _default: number) =>
|
||||||
|
parseInt(env(name, _default.toString()))
|
||||||
|
|
||||||
export const envb = (name: string, _default: boolean) => boolean(env(name, _default.toString()))
|
export const envb = (name: PublicEnvName, _default: boolean) =>
|
||||||
|
boolean(env(name, _default.toString()))
|
||||||
|
|
||||||
export const PUBLIC_APP_DB = env('PUBLIC_APP_DB', 'pockethost-central')
|
export const PUBLIC_APP_DB = env('PUBLIC_APP_DB', 'pockethost-central')
|
||||||
export const PUBLIC_APP_DOMAIN = env('PUBLIC_APP_DOMAIN', 'pockethost.io')
|
export const PUBLIC_APP_DOMAIN = env('PUBLIC_APP_DOMAIN', 'pockethost.io')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user