From f07f4789ee1e0b4451cf93d974c16eca8a4915f8 Mon Sep 17 00:00:00 2001 From: Max Leiter Date: Sun, 18 Dec 2022 13:46:52 -0800 Subject: [PATCH] cleanup view-document styling in jsx --- .../components/post-files/view-document/index.tsx | 2 +- src/lib/config.ts | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/app/(posts)/post/[id]/components/post-files/view-document/index.tsx b/src/app/(posts)/post/[id]/components/post-files/view-document/index.tsx index d8c93454..d23aa006 100644 --- a/src/app/(posts)/post/[id]/components/post-files/view-document/index.tsx +++ b/src/app/(posts)/post/[id]/components/post-files/view-document/index.tsx @@ -63,7 +63,7 @@ const Document = ({ skeleton, ...props }: Props) => { return ( <>
-
+
diff --git a/src/lib/config.ts b/src/lib/config.ts index 1aaba368..baf34e22 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -20,10 +20,8 @@ export const config = (env: Environment): Config => { return true } else if (str === "false" || str === "0") { return false - } else if (str) { - throw new Error(`Invalid boolean value: ${str}`) } else { - return false + return Boolean(str) } } @@ -59,8 +57,11 @@ export const config = (env: Environment): Config => { const is_production = env.NODE_ENV === "production" const developmentDefault = (name: string, defaultValue: string): string => { - if (is_production) return throwIfUndefined(name) - return defaultIfUndefined(name, defaultValue) + if (is_production) { + return throwIfUndefined(name) + } else { + return defaultIfUndefined(name, defaultValue) + } } validNodeEnvs(env.NODE_ENV) @@ -77,9 +78,7 @@ export const config = (env: Environment): Config => { github_client_id: env.GITHUB_CLIENT_ID ?? "", github_client_secret: env.GITHUB_CLIENT_SECRET ?? "", nextauth_secret: throwIfUndefined("NEXTAUTH_SECRET"), - credential_auth: stringToBoolean( - developmentDefault("CREDENTIAL_AUTH", "true") - ) + credential_auth: stringToBoolean("CREDENTIAL_AUTH") } return config }