-const CONFIG = {
- CUSTOM_FILE: getLocalConfigFilePath(),
- LISTEN: {
- PORT: config.get<number>('listen.port'),
- HOSTNAME: config.get<string>('listen.hostname')
- },
- DATABASE: {
- DBNAME: 'peertube' + config.get<string>('database.suffix'),
- HOSTNAME: config.get<string>('database.hostname'),
- PORT: config.get<number>('database.port'),
- USERNAME: config.get<string>('database.username'),
- PASSWORD: config.get<string>('database.password'),
- POOL: {
- MAX: config.get<number>('database.pool.max')
- }
- },
- REDIS: {
- HOSTNAME: config.has('redis.hostname') ? config.get<string>('redis.hostname') : null,
- PORT: config.has('redis.port') ? config.get<number>('redis.port') : null,
- SOCKET: config.has('redis.socket') ? config.get<string>('redis.socket') : null,
- AUTH: config.has('redis.auth') ? config.get<string>('redis.auth') : null,
- DB: config.has('redis.db') ? config.get<number>('redis.db') : null
- },
- SMTP: {
- HOSTNAME: config.get<string>('smtp.hostname'),
- PORT: config.get<number>('smtp.port'),
- USERNAME: config.get<string>('smtp.username'),
- PASSWORD: config.get<string>('smtp.password'),
- TLS: config.get<boolean>('smtp.tls'),
- DISABLE_STARTTLS: config.get<boolean>('smtp.disable_starttls'),
- CA_FILE: config.get<string>('smtp.ca_file'),
- FROM_ADDRESS: config.get<string>('smtp.from_address')
- },
- STORAGE: {
- AVATARS_DIR: buildPath(config.get<string>('storage.avatars')),
- LOG_DIR: buildPath(config.get<string>('storage.logs')),
- VIDEOS_DIR: buildPath(config.get<string>('storage.videos')),
- THUMBNAILS_DIR: buildPath(config.get<string>('storage.thumbnails')),
- PREVIEWS_DIR: buildPath(config.get<string>('storage.previews')),
- CAPTIONS_DIR: buildPath(config.get<string>('storage.captions')),
- TORRENTS_DIR: buildPath(config.get<string>('storage.torrents')),
- CACHE_DIR: buildPath(config.get<string>('storage.cache'))
- },
- WEBSERVER: {
- SCHEME: config.get<boolean>('webserver.https') === true ? 'https' : 'http',
- WS: config.get<boolean>('webserver.https') === true ? 'wss' : 'ws',
- HOSTNAME: config.get<string>('webserver.hostname'),
- PORT: config.get<number>('webserver.port'),
- URL: '',
- HOST: ''
- },
- TRUST_PROXY: config.get<string[]>('trust_proxy'),
- LOG: {
- LEVEL: config.get<string>('log.level')
- },
- SEARCH: {
- REMOTE_URI: {
- USERS: config.get<boolean>('search.remote_uri.users'),
- ANONYMOUS: config.get<boolean>('search.remote_uri.anonymous')
- }
- },
- TRENDING: {
- VIDEOS: {
- INTERVAL_DAYS: config.get<number>('trending.videos.interval_days')
- }
- },
- ADMIN: {
- get EMAIL () { return config.get<string>('admin.email') }
- },
- SIGNUP: {
- get ENABLED () { return config.get<boolean>('signup.enabled') },
- get LIMIT () { return config.get<number>('signup.limit') },
- get REQUIRES_EMAIL_VERIFICATION () { return config.get<boolean>('signup.requires_email_verification') },
- FILTERS: {
- CIDR: {
- get WHITELIST () { return config.get<string[]>('signup.filters.cidr.whitelist') },
- get BLACKLIST () { return config.get<string[]>('signup.filters.cidr.blacklist') }
- }
- }
- },
- USER: {
- get VIDEO_QUOTA () { return config.get<number>('user.video_quota') },
- get VIDEO_QUOTA_DAILY () { return config.get<number>('user.video_quota_daily') }
- },
- TRANSCODING: {
- get ENABLED () { return config.get<boolean>('transcoding.enabled') },
- get THREADS () { return config.get<number>('transcoding.threads') },
- RESOLUTIONS: {
- get '240p' () { return config.get<boolean>('transcoding.resolutions.240p') },
- get '360p' () { return config.get<boolean>('transcoding.resolutions.360p') },
- get '480p' () { return config.get<boolean>('transcoding.resolutions.480p') },
- get '720p' () { return config.get<boolean>('transcoding.resolutions.720p') },
- get '1080p' () { return config.get<boolean>('transcoding.resolutions.1080p') }
- }
- },
- IMPORT: {
- VIDEOS: {
- HTTP: {
- get ENABLED () { return config.get<boolean>('import.videos.http.enabled') }
- },
- TORRENT: {
- get ENABLED () { return config.get<boolean>('import.videos.torrent.enabled') }
- }
- }
- },
- CACHE: {
- PREVIEWS: {
- get SIZE () { return config.get<number>('cache.previews.size') }
- },
- VIDEO_CAPTIONS: {
- get SIZE () { return config.get<number>('cache.captions.size') }
- }
- },
- INSTANCE: {
- get NAME () { return config.get<string>('instance.name') },
- get SHORT_DESCRIPTION () { return config.get<string>('instance.short_description') },
- get DESCRIPTION () { return config.get<string>('instance.description') },
- get TERMS () { return config.get<string>('instance.terms') },
- get DEFAULT_CLIENT_ROUTE () { return config.get<string>('instance.default_client_route') },
- get DEFAULT_NSFW_POLICY () { return config.get<NSFWPolicyType>('instance.default_nsfw_policy') },
- CUSTOMIZATIONS: {
- get JAVASCRIPT () { return config.get<string>('instance.customizations.javascript') },
- get CSS () { return config.get<string>('instance.customizations.css') }
- },
- get ROBOTS () { return config.get<string>('instance.robots') }
- },
- SERVICES: {
- TWITTER: {
- get USERNAME () { return config.get<string>('services.twitter.username') },
- get WHITELISTED () { return config.get<boolean>('services.twitter.whitelisted') }
- }
- }
-}
-
-// ---------------------------------------------------------------------------
-
-const CONSTRAINTS_FIELDS = {