mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-10-01 07:37:55 -05:00
Zod validated config for security and ease of getting started
This commit is contained in:
16
app/modules/twitch/utils.server.ts
Normal file
16
app/modules/twitch/utils.server.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { ServerConfig } from "~/config.server";
|
||||
import invariant from "~/utils/invariant";
|
||||
|
||||
export const hasTwitchEnvVars = () =>
|
||||
Boolean(ServerConfig.twitch.clientId && ServerConfig.twitch.clientSecret);
|
||||
|
||||
export const getTwitchEnvVars = () => {
|
||||
const { clientId, clientSecret } = ServerConfig.twitch;
|
||||
invariant(clientId, "Missing TWITCH_CLIENT_ID env var, showing no streams");
|
||||
invariant(
|
||||
clientSecret,
|
||||
"Missing TWITCH_CLIENT_SECRET env var, showing no streams",
|
||||
);
|
||||
|
||||
return { TWITCH_CLIENT_ID: clientId, TWITCH_CLIENT_SECRET: clientSecret };
|
||||
};
|
||||
Reference in New Issue
Block a user