-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
88 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,49 @@ | ||
export const DONATE_URL = 'https://www.donationalerts.com/r/hmbanan666' | ||
export const DISCORD_SERVER_INVITE_URL = 'https://discord.gg/B6etUajrGZ' | ||
export const TWITCH_URL = 'https://www.twitch.tv/hmbanan666' | ||
export const GITHUB_REPO_URL = 'https://github.com/hmbanan666/chat-game' | ||
|
||
export const TWITCH_CHANNEL_REWARDS = { | ||
add150ViewerPointsId: 'd8237822-c943-434f-9d7e-87a9f549f4c4', | ||
villainStealFuelId: 'd5956de4-54ff-49e4-afbe-ee4e62718eee', | ||
addNewIdea: '289457e8-18c2-4b68-8564-fc61dd60b2a2', | ||
} | ||
|
||
export const ADMIN_PLAYER_ID = 'svhjz9p5467wne9ybasf1bwy' | ||
import { z } from 'zod' | ||
import { env as publicEnv } from '$env/dynamic/public' | ||
import { env as privateEnv } from '$env/dynamic/private' | ||
|
||
const allEnv = z.object({ | ||
PRIVATE_JWT_SECRET_KEY: z.string().default(''), | ||
PRIVATE_WEBSITE_BEARER: z.string().default(''), | ||
PUBLIC_COOKIE_KEY: z.string().default(''), | ||
PUBLIC_SIGNIN_REDIRECT_URL: z.string().default(''), | ||
PUBLIC_WEBSOCKET_URL: z.string().default(''), | ||
PUBLIC_DONATE_URL: z.string().default('https://www.donationalerts.com/r/hmbanan666'), | ||
PUBLIC_GITHUB_REPO_URL: z.string().default('https://github.com/hmbanan666/chat-game'), | ||
PUBLIC_DISCORD_SERVER_INVITE_URL: z.string().default('https://discord.gg/B6etUajrGZ'), | ||
PUBLIC_GAME_ADMIN_PLAYER_ID: z.string().default('svhjz9p5467wne9ybasf1bwy'), | ||
PUBLIC_TWITCH_CLIENT_ID: z.string().default(''), | ||
PUBLIC_TWITCH_URL: z.string().default('https://www.twitch.tv/hmbanan666'), | ||
PUBLIC_TWITCH_CHANNEL_REWARDS: z.string().default(JSON.stringify({ | ||
add150ViewerPointsId: 'd8237822-c943-434f-9d7e-87a9f549f4c4', | ||
villainStealFuelId: 'd5956de4-54ff-49e4-afbe-ee4e62718eee', | ||
addNewIdea: '289457e8-18c2-4b68-8564-fc61dd60b2a2', | ||
})), | ||
}) | ||
|
||
const serverConfigSchema = allEnv.transform((value) => { | ||
return { | ||
jwtSecretKey: value.PRIVATE_JWT_SECRET_KEY, | ||
websiteBearer: value.PRIVATE_WEBSITE_BEARER, | ||
cookieKey: value.PUBLIC_COOKIE_KEY, | ||
signInRedirectUrl: value.PUBLIC_SIGNIN_REDIRECT_URL, | ||
websocketUrl: value.PUBLIC_WEBSOCKET_URL, | ||
donateUrl: value.PUBLIC_DONATE_URL, | ||
githubRepoUrl: value.PUBLIC_GITHUB_REPO_URL, | ||
discordServerInviteUrl: value.PUBLIC_DISCORD_SERVER_INVITE_URL, | ||
game: { | ||
adminPlayerId: value.PUBLIC_GAME_ADMIN_PLAYER_ID, | ||
}, | ||
twitch: { | ||
clientId: value.PUBLIC_TWITCH_CLIENT_ID, | ||
url: value.PUBLIC_TWITCH_URL, | ||
rewards: JSON.parse(value.PUBLIC_TWITCH_CHANNEL_REWARDS), | ||
}, | ||
} | ||
}) | ||
|
||
export const serverConfig = serverConfigSchema.parse({ ...privateEnv, ...publicEnv }) | ||
export const clientConfig = {} | ||
|
||
export type ServerConfig = z.infer<typeof serverConfigSchema> | ||
export type ClientConfig = typeof clientConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { ChatGameAPI } from '@hmbanan666/chat-game-api' | ||
import { env } from '$env/dynamic/private' | ||
import { serverConfig } from '$lib/config' | ||
|
||
export const api = new ChatGameAPI(env.PRIVATE_WEBSITE_BEARER ?? '') | ||
export const api = new ChatGameAPI(serverConfig.websiteBearer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
import { env } from '$env/dynamic/public' | ||
import { serverConfig } from '$lib/config' | ||
|
||
export async function load({ cookies }) { | ||
const cookieKey = env.PUBLIC_COOKIE_KEY ?? '' | ||
|
||
return { | ||
gameProfileJWT: cookies.get(cookieKey), | ||
gameProfileJWT: cookies.get(serverConfig.cookieKey), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters