diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-09-25 23:24:16 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-09-25 23:24:16 +0200 |
commit | e0b526e7de810fd0fcfde45d22bb7edc72fe71ce (patch) | |
tree | aa07838c6b527e13909a42e38f51ebce19c323f2 /util/src/entities | |
parent | :bug: fix #392 (diff) | |
download | server-e0b526e7de810fd0fcfde45d22bb7edc72fe71ce.tar.xz |
:sparkles: key value config
Diffstat (limited to 'util/src/entities')
-rw-r--r-- | util/src/entities/Config.ts | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/util/src/entities/Config.ts b/util/src/entities/Config.ts index a460b437..6d9db470 100644 --- a/util/src/entities/Config.ts +++ b/util/src/entities/Config.ts @@ -1,12 +1,15 @@ -import { Column, Entity, JoinColumn, ManyToOne } from "typeorm"; -import { BaseClass } from "./BaseClass"; +import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm"; +import { BaseClass, BaseClassWithoutId } from "./BaseClass"; import crypto from "crypto"; import { Snowflake } from "../util/Snowflake"; @Entity("config") -export class ConfigEntity extends BaseClass { - @Column({ type: "simple-json" }) - value: ConfigValue; +export class ConfigEntity extends BaseClassWithoutId { + @PrimaryColumn() + key: string; + + @Column({ type: "simple-json", nullable: true }) + value: number | boolean | null | string | undefined; } export interface RateLimitOptions { @@ -37,14 +40,16 @@ export interface KafkaBroker { export interface ConfigValue { gateway: { endpointClient: string | null; - endpoint: string | null; + endpointPrivate: string | null; + endpointPublic: string | null; }; cdn: { endpointClient: string | null; - endpoint: string | null; + endpointPublic: string | null; + endpointPrivate: string | null; }; general: { - instance_id: string; + instanceId: string; }; permissions: { user: { @@ -149,14 +154,16 @@ export interface ConfigValue { export const DefaultConfigOptions: ConfigValue = { gateway: { endpointClient: null, - endpoint: null, + endpointPrivate: null, + endpointPublic: null, }, cdn: { endpointClient: null, - endpoint: null, + endpointPrivate: null, + endpointPublic: null, }, general: { - instance_id: Snowflake.generate(), + instanceId: Snowflake.generate(), }, permissions: { user: { |