2022-11-14 23:39:32 -05:00
|
|
|
import { Column, Entity, PrimaryColumn } from 'typeorm';
|
|
|
|
|
|
|
|
|
|
@Entity('system_config')
|
2022-12-09 15:51:42 -05:00
|
|
|
export class SystemConfigEntity<T = string> {
|
2022-11-14 23:39:32 -05:00
|
|
|
@PrimaryColumn()
|
|
|
|
|
key!: SystemConfigKey;
|
|
|
|
|
|
2022-12-09 15:51:42 -05:00
|
|
|
@Column({ type: 'varchar', nullable: true, transformer: { to: JSON.stringify, from: JSON.parse } })
|
|
|
|
|
value!: T;
|
2022-11-14 23:39:32 -05:00
|
|
|
}
|
|
|
|
|
|
2022-12-09 15:51:42 -05:00
|
|
|
export type SystemConfigValue = any;
|
2022-11-14 23:39:32 -05:00
|
|
|
|
2022-12-09 15:51:42 -05:00
|
|
|
// dot notation matches path in `SystemConfig`
|
2022-11-14 23:39:32 -05:00
|
|
|
export enum SystemConfigKey {
|
2022-12-09 15:51:42 -05:00
|
|
|
FFMPEG_CRF = 'ffmpeg.crf',
|
|
|
|
|
FFMPEG_PRESET = 'ffmpeg.preset',
|
|
|
|
|
FFMPEG_TARGET_VIDEO_CODEC = 'ffmpeg.targetVideoCodec',
|
|
|
|
|
FFMPEG_TARGET_AUDIO_CODEC = 'ffmpeg.targetAudioCodec',
|
|
|
|
|
FFMPEG_TARGET_SCALING = 'ffmpeg.targetScaling',
|
|
|
|
|
OAUTH_ENABLED = 'oauth.enabled',
|
|
|
|
|
OAUTH_ISSUER_URL = 'oauth.issuerUrl',
|
|
|
|
|
OAUTH_CLIENT_ID = 'oauth.clientId',
|
|
|
|
|
OAUTH_CLIENT_SECRET = 'oauth.clientSecret',
|
|
|
|
|
OAUTH_SCOPE = 'oauth.scope',
|
|
|
|
|
OAUTH_BUTTON_TEXT = 'oauth.buttonText',
|
|
|
|
|
OAUTH_AUTO_REGISTER = 'oauth.autoRegister',
|
2022-11-14 23:39:32 -05:00
|
|
|
}
|
|
|
|
|
|
2022-12-09 15:51:42 -05:00
|
|
|
export interface SystemConfig {
|
|
|
|
|
ffmpeg: {
|
|
|
|
|
crf: string;
|
|
|
|
|
preset: string;
|
|
|
|
|
targetVideoCodec: string;
|
|
|
|
|
targetAudioCodec: string;
|
|
|
|
|
targetScaling: string;
|
|
|
|
|
};
|
|
|
|
|
oauth: {
|
|
|
|
|
enabled: boolean;
|
|
|
|
|
issuerUrl: string;
|
|
|
|
|
clientId: string;
|
|
|
|
|
clientSecret: string;
|
|
|
|
|
scope: string;
|
|
|
|
|
buttonText: string;
|
|
|
|
|
autoRegister: boolean;
|
|
|
|
|
};
|
2022-11-14 23:39:32 -05:00
|
|
|
}
|