diff options
Diffstat (limited to 'config')
| -rw-r--r-- | config/Config.ts | 13 | ||||
| -rw-r--r-- | config/example-options.ts | 1 |
2 files changed, 11 insertions, 3 deletions
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<string>; /** * 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<Snowflake | ''>; }; /** @@ -223,6 +223,11 @@ export type ConfigChannelKey = 'log' | 'error' | 'dm' | 'servers'; */ export interface DataBase { /** + * Ex. "tanzanite" would use the databases "tanzanite", "tanzanite-beta", "tanzanite-dev", and "tanzanite-shared". + */ + databasePrefix: string; + + /** * The host of the database. */ host: string; @@ -272,3 +277,5 @@ export interface SupportGuild { */ invite: string | null; } + +export type EnvironmentMap<T> = 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]', |
