summary refs log tree commit diff
path: root/src/util/config
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-12-19 16:51:24 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-12-19 16:51:24 +1100
commitd407d8ebe7ce34f3f85b5241ea6a1d0381b74e09 (patch)
tree099f8af27e5f7b27f0cfd43cc5c2bba0505b9957 /src/util/config
parentMake ConfigValue a directory, move defaults to those classes instead of a sep... (diff)
downloadserver-d407d8ebe7ce34f3f85b5241ea6a1d0381b74e09.tar.xz
Add additional config
Diffstat (limited to 'src/util/config')
-rw-r--r--src/util/config/Config.ts25
-rw-r--r--src/util/config/index.ts2
-rw-r--r--src/util/config/types/CdnConfiguration.ts7
-rw-r--r--src/util/config/types/ClientConfiguration.ts2
-rw-r--r--src/util/config/types/ExternalTokensConfiguration.ts3
-rw-r--r--src/util/config/types/GeneralConfiguration.ts4
-rw-r--r--src/util/config/types/GuildConfiguration.ts1
-rw-r--r--src/util/config/types/RegisterConfiguration.ts4
-rw-r--r--src/util/config/types/SecurityConfiguration.ts2
-rw-r--r--src/util/config/types/index.ts4
-rw-r--r--src/util/config/types/subconfigurations/index.ts16
11 files changed, 49 insertions, 21 deletions
diff --git a/src/util/config/Config.ts b/src/util/config/Config.ts
index b703040f..b6c725f5 100644
--- a/src/util/config/Config.ts
+++ b/src/util/config/Config.ts
@@ -1,8 +1,28 @@
-import { ApiConfiguration, ClientConfiguration, DefaultsConfiguration, EndpointConfiguration, GeneralConfiguration, GifConfiguration, GuildConfiguration, KafkaConfiguration, LimitsConfiguration, LoginConfiguration, MetricsConfiguration, RabbitMQConfiguration, RegionConfiguration, RegisterConfiguration, SecurityConfiguration, SentryConfiguration, TemplateConfiguration } from "../config";
+import {
+	ApiConfiguration,
+	CdnConfiguration,
+	ClientConfiguration,
+	DefaultsConfiguration,
+	EndpointConfiguration,
+	ExternalTokensConfiguration,
+	GeneralConfiguration,
+	GifConfiguration,
+	GuildConfiguration,
+	KafkaConfiguration,
+	LimitsConfiguration,
+	LoginConfiguration,
+	MetricsConfiguration,
+	RabbitMQConfiguration,
+	RegionConfiguration,
+	RegisterConfiguration,
+	SecurityConfiguration,
+	SentryConfiguration,
+	TemplateConfiguration
+} from "../config";
 
 export class ConfigValue {
 	gateway: EndpointConfiguration = new EndpointConfiguration();
-	cdn: EndpointConfiguration = new EndpointConfiguration();
+	cdn: CdnConfiguration = new CdnConfiguration();
 	api: ApiConfiguration = new ApiConfiguration();
 	general: GeneralConfiguration = new GeneralConfiguration();
 	limits: LimitsConfiguration = new LimitsConfiguration();
@@ -19,4 +39,5 @@ export class ConfigValue {
 	metrics: MetricsConfiguration = new MetricsConfiguration();
 	sentry: SentryConfiguration = new SentryConfiguration();
 	defaults: DefaultsConfiguration = new DefaultsConfiguration();
+	external: ExternalTokensConfiguration = new ExternalTokensConfiguration();
 }
\ No newline at end of file
diff --git a/src/util/config/index.ts b/src/util/config/index.ts
index 0a9b58ae..adb6984c 100644
--- a/src/util/config/index.ts
+++ b/src/util/config/index.ts
@@ -1,2 +1,2 @@
 export * from "./Config";
-export * from "./types/index";
+export * from "./types";
diff --git a/src/util/config/types/CdnConfiguration.ts b/src/util/config/types/CdnConfiguration.ts
new file mode 100644
index 00000000..f58c1c64
--- /dev/null
+++ b/src/util/config/types/CdnConfiguration.ts
@@ -0,0 +1,7 @@
+import { EndpointConfiguration } from "./EndpointConfiguration";
+
+export class CdnConfiguration extends EndpointConfiguration {
+	resizeHeightMax: number = 1000;
+	resizeWidthMax: number = 1000;
+	imagorServerUrl: string | null = null;
+}
\ No newline at end of file
diff --git a/src/util/config/types/ClientConfiguration.ts b/src/util/config/types/ClientConfiguration.ts
index 1adda1e2..69b5e154 100644
--- a/src/util/config/types/ClientConfiguration.ts
+++ b/src/util/config/types/ClientConfiguration.ts
@@ -1,8 +1,6 @@
 import { ClientReleaseConfiguration } from ".";
 
 export class ClientConfiguration {
-    //classes
     releases: ClientReleaseConfiguration = new ClientReleaseConfiguration();
-    //base types
     useTestClient: boolean = true;
 }
\ No newline at end of file
diff --git a/src/util/config/types/ExternalTokensConfiguration.ts b/src/util/config/types/ExternalTokensConfiguration.ts
new file mode 100644
index 00000000..5c020745
--- /dev/null
+++ b/src/util/config/types/ExternalTokensConfiguration.ts
@@ -0,0 +1,3 @@
+export class ExternalTokensConfiguration {
+	twitter: string | null = null;
+}
\ No newline at end of file
diff --git a/src/util/config/types/GeneralConfiguration.ts b/src/util/config/types/GeneralConfiguration.ts
index 55848b44..7c0ffa66 100644
--- a/src/util/config/types/GeneralConfiguration.ts
+++ b/src/util/config/types/GeneralConfiguration.ts
@@ -1,11 +1,11 @@
-import { Snowflake } from "../../util";
+import { Snowflake } from "@fosscord/util";
 
 export class GeneralConfiguration {
 	instanceName: string = "Fosscord Instance";
 	instanceDescription: string | null = "This is a Fosscord instance made in the pre-release days";
 	frontPage: string | null = null;
 	tosPage: string | null = null;
-	correspondenceEmail: string | null = "noreply@localhost.local";
+	correspondenceEmail: string | null = null;
 	correspondenceUserID: string | null = null;
 	image: string | null = null;
 	instanceId: string = Snowflake.generate();
diff --git a/src/util/config/types/GuildConfiguration.ts b/src/util/config/types/GuildConfiguration.ts
index 3d43b368..e77d3fce 100644
--- a/src/util/config/types/GuildConfiguration.ts
+++ b/src/util/config/types/GuildConfiguration.ts
@@ -3,4 +3,5 @@ import { DiscoveryConfiguration, AutoJoinConfiguration } from ".";
 export class GuildConfiguration {
     discovery: DiscoveryConfiguration = new DiscoveryConfiguration();
     autoJoin: AutoJoinConfiguration = new AutoJoinConfiguration();
+	defaultFeatures: string[] = [];
 }
diff --git a/src/util/config/types/RegisterConfiguration.ts b/src/util/config/types/RegisterConfiguration.ts
index a0dc97c5..75b40417 100644
--- a/src/util/config/types/RegisterConfiguration.ts
+++ b/src/util/config/types/RegisterConfiguration.ts
@@ -1,11 +1,9 @@
 import { DateOfBirthConfiguration, EmailConfiguration, PasswordConfiguration } from ".";
 
 export class RegisterConfiguration {
-    //classes
     email: EmailConfiguration = new EmailConfiguration();
     dateOfBirth: DateOfBirthConfiguration = new DateOfBirthConfiguration();
     password: PasswordConfiguration = new PasswordConfiguration();
-    //base types
     disabled: boolean = false;
     requireCaptcha: boolean = true;
     requireInvite: boolean = false;
@@ -14,5 +12,5 @@ export class RegisterConfiguration {
     allowMultipleAccounts: boolean = true;
     blockProxies: boolean = true;
     incrementingDiscriminators: boolean = false; // random otherwise
-    defaultRights: string = "0";
+    defaultRights: string = "30644591655940";	// See `npm run generate:rights`
 }
diff --git a/src/util/config/types/SecurityConfiguration.ts b/src/util/config/types/SecurityConfiguration.ts
index 405b86ac..60f4a9c8 100644
--- a/src/util/config/types/SecurityConfiguration.ts
+++ b/src/util/config/types/SecurityConfiguration.ts
@@ -2,10 +2,8 @@ import crypto from "crypto";
 import { CaptchaConfiguration, TwoFactorConfiguration } from ".";
 
 export class SecurityConfiguration {
-    //classes
     captcha: CaptchaConfiguration = new CaptchaConfiguration();
     twoFactor: TwoFactorConfiguration = new TwoFactorConfiguration();
-    //base types
     autoUpdate: boolean | number = true;
     requestSignature: string = crypto.randomBytes(32).toString("base64");
     jwtSecret: string = crypto.randomBytes(256).toString("base64");
diff --git a/src/util/config/types/index.ts b/src/util/config/types/index.ts
index 608503a0..f20fe121 100644
--- a/src/util/config/types/index.ts
+++ b/src/util/config/types/index.ts
@@ -1,7 +1,9 @@
 export * from "./ApiConfiguration";
+export * from "./CdnConfiguration";
 export * from "./ClientConfiguration";
 export * from "./DefaultsConfiguration";
 export * from "./EndpointConfiguration";
+export * from "./ExternalTokensConfiguration";
 export * from "./GeneralConfiguration";
 export * from "./GifConfiguration";
 export * from "./GuildConfiguration";
@@ -15,4 +17,4 @@ export * from "./RegisterConfiguration";
 export * from "./SecurityConfiguration";
 export * from "./SentryConfiguration";
 export * from "./TemplateConfiguration";
-export * from "./subconfigurations/index";
+export * from "./subconfigurations";
\ No newline at end of file
diff --git a/src/util/config/types/subconfigurations/index.ts b/src/util/config/types/subconfigurations/index.ts
index bfbadc92..5bd60911 100644
--- a/src/util/config/types/subconfigurations/index.ts
+++ b/src/util/config/types/subconfigurations/index.ts
@@ -1,8 +1,8 @@
-export * from "./client/index";
-export * from "./defaults/index";
-export * from "./guild/index";
-export * from "./kafka/index";
-export * from "./limits/index";
-export * from "./region/index";
-export * from "./register/index";
-export * from "./security/index";
+export * from "./client";
+export * from "./defaults";
+export * from "./guild";
+export * from "./kafka";
+export * from "./limits";
+export * from "./region";
+export * from "./register";
+export * from "./security";