-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
659b45a
commit 252c88a
Showing
15 changed files
with
719 additions
and
606 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,21 +1,6 @@ | ||
// Function type is safe since only name is accessed | ||
/* eslint-disable @typescript-eslint/ban-types */ | ||
export class Caller { | ||
private readonly caller: Function; | ||
private readonly module: NodeModule; | ||
export type Caller = `${string}#${string}`; | ||
|
||
constructor(module: NodeModule, caller: Function) { | ||
this.module = module; | ||
this.caller = caller; | ||
} | ||
|
||
toString() { | ||
const { filename: url } = this.module; | ||
const { name: fragment } = this.caller; | ||
return `${url}#${fragment}`; | ||
} | ||
} | ||
|
||
export default (module: NodeModule, caller: Function) => | ||
new Caller(module, caller); | ||
/* eslint-enable @typescript-eslint/ban-types */ | ||
export default ( | ||
{ filename }: NodeModule, | ||
{ name }: Record<"name", string>, | ||
): Caller => `${filename}#${name}`; |
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,28 +1,21 @@ | ||
import assert from "node:assert"; | ||
|
||
const { env: environmentVariables } = process; | ||
const environmentVariable = (key: string, defaultValue?: string) => { | ||
const value = environmentVariables[key]; | ||
if (value !== undefined) return value; | ||
if (defaultValue !== undefined) return defaultValue; | ||
assert.fail(); | ||
}; | ||
|
||
const { env } = process; | ||
export default { | ||
BotGuildId: environmentVariables.BOT_GUILD_ID, | ||
DiscordToken: environmentVariable("DISCORD_TOKEN"), | ||
EnableCarsized: environmentVariable("ENABLE_CARSIZED", "false"), | ||
ExpressPort: environmentVariable("EXPRESS_PORT", "8080"), | ||
PostgresqlDatabase: environmentVariable("POSTGRESQL_DATABASE", "db"), | ||
PostgresqlHost: environmentVariable("POSTGRESQL_HOST", "postgres"), | ||
PostgresqlPassword: environmentVariable("POSTGRESQL_PASSWORD", "password"), | ||
PostgresqlPort: environmentVariable("POSTGRESQL_PORT", "5432"), | ||
PostgresqlUser: environmentVariable("POSTGRESQL_USER", "user"), | ||
ProjectName: environmentVariable("PROJECT_NAME", "Pedestrian"), | ||
RedisCluster: environmentVariable("REDIS_CLUSTER", "false"), | ||
RedisHost: environmentVariable("REDIS_HOST", "redis"), | ||
RedisPassword: environmentVariables.REDIS_PASSWORD, | ||
RedisPort: environmentVariable("REDIS_PORT", "6379"), | ||
RedisUsername: environmentVariables.REDIS_USERNAME, | ||
YoutubeApiKey: environmentVariable("YOUTUBE_API_KEY"), | ||
BotGuildId: env.BOT_GUILD_ID, | ||
DiscordToken: env.DISCORD_TOKEN ?? assert.fail(), | ||
EnableCarsized: Boolean(env.ENABLE_CARSIZED), | ||
ExpressPort: Number(env.EXPRESS_PORT ?? 8080), | ||
PostgresqlDatabase: env.POSTGRESQL_DATABASE ?? "db", | ||
PostgresqlHost: env.POSTGRESQL_HOST ?? "postgres", | ||
PostgresqlPassword: env.POSTGRESQL_PASSWORD ?? "password", | ||
PostgresqlPort: Number(env.POSTGRESQL_PORT ?? 5432), | ||
PostgresqlUser: env.POSTGRESQL_USER ?? "user", | ||
ProjectName: env.PROJECT_NAME ?? "Pedestrian", | ||
RedisCluster: Boolean(env.REDIS_CLUSTER), | ||
RedisHost: env.REDIS_HOST ?? "redis", | ||
RedisPassword: env.REDIS_PASSWORD, | ||
RedisPort: Number(env.REDIS_PORT ?? 6379), | ||
RedisUsername: env.REDIS_USERNAME, | ||
YoutubeApiKey: env.YOUTUBE_API_KEY ?? assert.fail(), | ||
} as const; |
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