Skip to content

Commit

Permalink
make sure we dont accept non-empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
dholms committed Apr 24, 2023
1 parent 5137b42 commit b4dc8ab
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/pds/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ export class ServerConfig {
)

// E.g. ws://abc.com:4000
const appViewRepoProvider = process.env.APP_VIEW_REPO_PROVIDER || undefined
const appViewRepoProvider = nonemptyString(
process.env.APP_VIEW_REPO_PROVIDER,
)

return new ServerConfig({
debugMode,
Expand Down Expand Up @@ -357,6 +359,11 @@ export class ServerConfig {
}
}

const nonemptyString = (str: string | undefined): string | undefined => {
if (str === undefined || str.length === 0) return undefined
return str
}

const parseIntWithFallback = <T>(
value: string | undefined,
fallback: T,
Expand Down

0 comments on commit b4dc8ab

Please sign in to comment.