MCPcopy Create free account
hub / github.com/Phalcode/gamevault-backend / parseBooleanEnvVariable

Function parseBooleanEnvVariable

src/configuration.ts:138–160  ·  view source on GitHub ↗
(
  environmentVariable: string,
  defaultCase: boolean = false,
)

Source from the content-addressed store, hash-verified

136}
137
138function parseBooleanEnvVariable(
139 environmentVariable: string,
140 defaultCase: boolean = false,
141): boolean {
142 switch (toLower(environmentVariable)) {
143 case "0":
144 case "false":
145 case "no":
146 case "off":
147 case "disable":
148 case "disabled":
149 return false;
150 case "1":
151 case "true":
152 case "yes":
153 case "on":
154 case "enable":
155 case "enabled":
156 return true;
157 default:
158 return defaultCase;
159 }
160}
161
162function parsePath(environmentVariable: string, defaultPath: string) {
163 return environmentVariable?.replace(/\/$/, "") || defaultPath;

Callers 1

configuration.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected