From 800668f3e0fec80f3ba08f115d9563324bc54045 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Mon, 29 Aug 2022 19:53:53 -0400 Subject: deploy stuff --- config/Config.ts | 13 ++++++++++--- config/example-options.ts | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'config') diff --git a/config/Config.ts b/config/Config.ts index 4aae10a..90d4428 100644 --- a/config/Config.ts +++ b/config/Config.ts @@ -51,7 +51,7 @@ export class Config implements ConfigOptions { this.credentials = options.credentials; this.environment = options.environment; this.owners = options.owners; - this.prefix = options.prefix; + this.prefix = typeof options.prefix === 'string' ? options.prefix : options.prefix[this.environment]; this.channels = options.channels; this.db = options.db; this.logging = options.logging; @@ -118,7 +118,7 @@ export interface ConfigOptions { /** * A string that needs to come before text commands. */ - prefix: string; + prefix: EnvironmentMap; /** * Various discord channels that logs will be sent in. @@ -210,7 +210,7 @@ export type Channels = { * The id of a channel to send logging messages in, * use an empty string for no channel to be used. */ - [Key in ConfigChannelKey]: Snowflake | ''; + [Key in ConfigChannelKey]: EnvironmentMap; }; /** @@ -222,6 +222,11 @@ export type ConfigChannelKey = 'log' | 'error' | 'dm' | 'servers'; * Options for the Postgres database connection. */ export interface DataBase { + /** + * Ex. "tanzanite" would use the databases "tanzanite", "tanzanite-beta", "tanzanite-dev", and "tanzanite-shared". + */ + databasePrefix: string; + /** * The host of the database. */ @@ -272,3 +277,5 @@ export interface SupportGuild { */ invite: string | null; } + +export type EnvironmentMap = T | { [Key in Environment]: T }; diff --git a/config/example-options.ts b/config/example-options.ts index 43b805e..903928d 100644 --- a/config/example-options.ts +++ b/config/example-options.ts @@ -26,6 +26,7 @@ export default new Config({ servers: '1000000000000000' }, db: { + databasePrefix: 'tanzanite', host: 'localhost', port: 5432, username: '[USER_NAME]', -- cgit