1 import { IConfig } from 'config'
2 import { dirname, join } from 'path'
3 import { JobType, VideoRateType, VideoState, VideosRedundancy } from '../../shared/models'
4 import { ActivityPubActorType } from '../../shared/models/activitypub'
5 import { FollowState } from '../../shared/models/actors'
6 import { VideoAbuseState, VideoImportState, VideoPrivacy } from '../../shared/models/videos'
7 // Do not use barrels, remain constants as independent as possible
8 import { buildPath, isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils'
9 import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
10 import { invert } from 'lodash'
11 import { CronRepeatOptions, EveryRepeatOptions } from 'bull'
12 import * as bytes from 'bytes'
14 // Use a variable to reload the configuration if we need
15 let config: IConfig = require('config')
17 // ---------------------------------------------------------------------------
19 const LAST_MIGRATION_VERSION = 270
21 // ---------------------------------------------------------------------------
24 const API_VERSION = 'v1'
33 // Sortable columns per schema
34 const SORTABLE_COLUMNS = {
35 USERS: [ 'id', 'username', 'createdAt' ],
36 USER_SUBSCRIPTIONS: [ 'id', 'createdAt' ],
37 ACCOUNTS: [ 'createdAt' ],
38 JOBS: [ 'createdAt' ],
39 VIDEO_ABUSES: [ 'id', 'createdAt', 'state' ],
40 VIDEO_CHANNELS: [ 'id', 'name', 'updatedAt', 'createdAt' ],
41 VIDEO_IMPORTS: [ 'createdAt' ],
42 VIDEO_COMMENT_THREADS: [ 'createdAt' ],
43 BLACKLISTS: [ 'id', 'name', 'duration', 'views', 'likes', 'dislikes', 'uuid', 'createdAt' ],
44 FOLLOWERS: [ 'createdAt' ],
45 FOLLOWING: [ 'createdAt' ],
47 VIDEOS: [ 'name', 'duration', 'createdAt', 'publishedAt', 'views', 'likes', 'trending' ],
49 VIDEOS_SEARCH: [ 'name', 'duration', 'createdAt', 'publishedAt', 'views', 'likes', 'match' ],
50 VIDEO_CHANNELS_SEARCH: [ 'match', 'displayName', 'createdAt' ]
53 const OAUTH_LIFETIME = {
54 ACCESS_TOKEN: 3600 * 24, // 1 day, for upload
55 REFRESH_TOKEN: 1209600 // 2 weeks
58 const ROUTE_CACHE_LIFETIME = {
61 SECURITYTXT: '2 hours',
62 NODEINFO: '10 minutes',
68 VIDEOS: '1 second' // 1 second, cache concurrent requests after a broadcast for example
72 // ---------------------------------------------------------------------------
74 // Number of points we add/remove after a successful/bad request
75 const ACTOR_FOLLOW_SCORE = {
82 const FOLLOW_STATES: { [ id: string ]: FollowState } = {
87 const REMOTE_SCHEME = {
92 const JOB_ATTEMPTS: { [ id in JobType ]: number } = {
93 'activitypub-http-broadcast': 5,
94 'activitypub-http-unicast': 5,
95 'activitypub-http-fetcher': 5,
96 'activitypub-follow': 5,
97 'video-file-import': 1,
103 const JOB_CONCURRENCY: { [ id in JobType ]: number } = {
104 'activitypub-http-broadcast': 1,
105 'activitypub-http-unicast': 5,
106 'activitypub-http-fetcher': 1,
107 'activitypub-follow': 3,
108 'video-file-import': 1,
114 const JOB_TTL: { [ id in JobType ]: number } = {
115 'activitypub-http-broadcast': 60000 * 10, // 10 minutes
116 'activitypub-http-unicast': 60000 * 10, // 10 minutes
117 'activitypub-http-fetcher': 60000 * 10, // 10 minutes
118 'activitypub-follow': 60000 * 10, // 10 minutes
119 'video-file-import': 1000 * 3600, // 1 hour
120 'video-file': 1000 * 3600 * 48, // 2 days, transcoding could be long
121 'video-import': 1000 * 3600 * 5, // 5 hours
122 'email': 60000 * 10, // 10 minutes
123 'videos-views': undefined // Unlimited
125 const REPEAT_JOBS: { [ id: string ]: EveryRepeatOptions | CronRepeatOptions } = {
127 cron: '1 * * * *' // At 1 minutes past the hour
131 const BROADCAST_CONCURRENCY = 10 // How many requests in parallel we do in activitypub-http-broadcast job
132 const CRAWL_REQUEST_CONCURRENCY = 1 // How many requests in parallel to fetch remote data (likes, shares...)
133 const JOB_REQUEST_TIMEOUT = 3000 // 3 seconds
134 const JOB_COMPLETED_LIFETIME = 60000 * 60 * 24 * 2 // 2 days
137 let SCHEDULER_INTERVALS_MS = {
138 badActorFollow: 60000 * 60, // 1 hour
139 removeOldJobs: 60000 * 60, // 1 hour
140 updateVideos: 60000, // 1 minute
141 youtubeDLUpdate: 60000 * 60 * 24, // 1 day
142 videosRedundancy: 60000 * 2 // 2 hours
145 // ---------------------------------------------------------------------------
148 CUSTOM_FILE: getLocalConfigFilePath(),
150 PORT: config.get<number>('listen.port'),
151 HOSTNAME: config.get<string>('listen.hostname')
154 DBNAME: 'peertube' + config.get<string>('database.suffix'),
155 HOSTNAME: config.get<string>('database.hostname'),
156 PORT: config.get<number>('database.port'),
157 USERNAME: config.get<string>('database.username'),
158 PASSWORD: config.get<string>('database.password'),
160 MAX: config.get<number>('database.pool.max')
164 HOSTNAME: config.has('redis.hostname') ? config.get<string>('redis.hostname') : null,
165 PORT: config.has('redis.port') ? config.get<number>('redis.port') : null,
166 SOCKET: config.has('redis.socket') ? config.get<string>('redis.socket') : null,
167 AUTH: config.has('redis.auth') ? config.get<string>('redis.auth') : null,
168 DB: config.has('redis.db') ? config.get<number>('redis.db') : null
171 HOSTNAME: config.get<string>('smtp.hostname'),
172 PORT: config.get<number>('smtp.port'),
173 USERNAME: config.get<string>('smtp.username'),
174 PASSWORD: config.get<string>('smtp.password'),
175 TLS: config.get<boolean>('smtp.tls'),
176 DISABLE_STARTTLS: config.get<boolean>('smtp.disable_starttls'),
177 CA_FILE: config.get<string>('smtp.ca_file'),
178 FROM_ADDRESS: config.get<string>('smtp.from_address')
181 AVATARS_DIR: buildPath(config.get<string>('storage.avatars')),
182 LOG_DIR: buildPath(config.get<string>('storage.logs')),
183 VIDEOS_DIR: buildPath(config.get<string>('storage.videos')),
184 THUMBNAILS_DIR: buildPath(config.get<string>('storage.thumbnails')),
185 PREVIEWS_DIR: buildPath(config.get<string>('storage.previews')),
186 CAPTIONS_DIR: buildPath(config.get<string>('storage.captions')),
187 TORRENTS_DIR: buildPath(config.get<string>('storage.torrents')),
188 CACHE_DIR: buildPath(config.get<string>('storage.cache'))
191 SCHEME: config.get<boolean>('webserver.https') === true ? 'https' : 'http',
192 WS: config.get<boolean>('webserver.https') === true ? 'wss' : 'ws',
193 HOSTNAME: config.get<string>('webserver.hostname'),
194 PORT: config.get<number>('webserver.port'),
198 TRUST_PROXY: config.get<string[]>('trust_proxy'),
200 LEVEL: config.get<string>('log.level')
204 USERS: config.get<boolean>('search.remote_uri.users'),
205 ANONYMOUS: config.get<boolean>('search.remote_uri.anonymous')
210 INTERVAL_DAYS: config.get<number>('trending.videos.interval_days')
214 VIDEOS: buildVideosRedundancy(config.get<any[]>('redundancy.videos'))
217 get EMAIL () { return config.get<string>('admin.email') }
220 get ENABLED () { return config.get<boolean>('signup.enabled') },
221 get LIMIT () { return config.get<number>('signup.limit') },
222 get REQUIRES_EMAIL_VERIFICATION () { return config.get<boolean>('signup.requires_email_verification') },
225 get WHITELIST () { return config.get<string[]>('signup.filters.cidr.whitelist') },
226 get BLACKLIST () { return config.get<string[]>('signup.filters.cidr.blacklist') }
231 get VIDEO_QUOTA () { return config.get<number>('user.video_quota') },
232 get VIDEO_QUOTA_DAILY () { return config.get<number>('user.video_quota_daily') }
235 get ENABLED () { return config.get<boolean>('transcoding.enabled') },
236 get THREADS () { return config.get<number>('transcoding.threads') },
238 get '240p' () { return config.get<boolean>('transcoding.resolutions.240p') },
239 get '360p' () { return config.get<boolean>('transcoding.resolutions.360p') },
240 get '480p' () { return config.get<boolean>('transcoding.resolutions.480p') },
241 get '720p' () { return config.get<boolean>('transcoding.resolutions.720p') },
242 get '1080p' () { return config.get<boolean>('transcoding.resolutions.1080p') }
248 get ENABLED () { return config.get<boolean>('import.videos.http.enabled') }
251 get ENABLED () { return config.get<boolean>('import.videos.torrent.enabled') }
257 get SIZE () { return config.get<number>('cache.previews.size') }
260 get SIZE () { return config.get<number>('cache.captions.size') }
264 get NAME () { return config.get<string>('instance.name') },
265 get SHORT_DESCRIPTION () { return config.get<string>('instance.short_description') },
266 get DESCRIPTION () { return config.get<string>('instance.description') },
267 get TERMS () { return config.get<string>('instance.terms') },
268 get DEFAULT_CLIENT_ROUTE () { return config.get<string>('instance.default_client_route') },
269 get DEFAULT_NSFW_POLICY () { return config.get<NSFWPolicyType>('instance.default_nsfw_policy') },
271 get JAVASCRIPT () { return config.get<string>('instance.customizations.javascript') },
272 get CSS () { return config.get<string>('instance.customizations.css') }
274 get ROBOTS () { return config.get<string>('instance.robots') },
275 get SECURITYTXT () { return config.get<string>('instance.securitytxt') },
276 get SECURITYTXT_CONTACT () { return config.get<string>('admin.email') }
280 get USERNAME () { return config.get<string>('services.twitter.username') },
281 get WHITELISTED () { return config.get<boolean>('services.twitter.whitelisted') }
286 // ---------------------------------------------------------------------------
288 const CONSTRAINTS_FIELDS = {
290 NAME: { min: 3, max: 120 }, // Length
291 DESCRIPTION: { min: 3, max: 250 }, // Length
292 USERNAME: { min: 3, max: 20 }, // Length
293 PASSWORD: { min: 6, max: 255 }, // Length
294 VIDEO_QUOTA: { min: -1 },
295 VIDEO_QUOTA_DAILY: { min: -1 },
296 BLOCKED_REASON: { min: 3, max: 250 } // Length
299 REASON: { min: 2, max: 300 }, // Length
300 MODERATION_COMMENT: { min: 2, max: 300 } // Length
303 REASON: { min: 2, max: 300 } // Length
306 NAME: { min: 3, max: 120 }, // Length
307 DESCRIPTION: { min: 3, max: 500 }, // Length
308 SUPPORT: { min: 3, max: 500 }, // Length
309 URL: { min: 3, max: 2000 } // Length
313 EXTNAME: [ '.vtt', '.srt' ],
315 max: 2 * 1024 * 1024 // 2MB
320 URL: { min: 3, max: 2000 }, // Length
321 TORRENT_NAME: { min: 3, max: 255 }, // Length
323 EXTNAME: [ '.torrent' ],
325 max: 1024 * 200 // 200 KB
330 URL: { min: 3, max: 2000 } // Length
333 NAME: { min: 3, max: 120 }, // Length
334 LANGUAGE: { min: 1, max: 10 }, // Length
335 TRUNCATED_DESCRIPTION: { min: 3, max: 250 }, // Length
336 DESCRIPTION: { min: 3, max: 10000 }, // Length
337 SUPPORT: { min: 3, max: 500 }, // Length
339 EXTNAME: [ '.jpg', '.jpeg' ],
341 max: 2 * 1024 * 1024 // 2MB
344 EXTNAME: [ '.mp4', '.ogv', '.webm' ],
345 INFO_HASH: { min: 40, max: 40 }, // Length, info hash is 20 bytes length but we represent it in hexadecimal so 20 * 2
346 DURATION: { min: 0 }, // Number
347 TAGS: { min: 0, max: 5 }, // Number of total tags
348 TAG: { min: 2, max: 30 }, // Length
349 THUMBNAIL: { min: 2, max: 30 },
350 THUMBNAIL_DATA: { min: 0, max: 20000 }, // Bytes
353 DISLIKES: { min: 0 },
354 FILE_SIZE: { min: 10 },
355 URL: { min: 3, max: 2000 } // Length
358 PUBLIC_KEY: { min: 10, max: 5000 }, // Length
359 PRIVATE_KEY: { min: 10, max: 5000 }, // Length
360 URL: { min: 3, max: 2000 }, // Length
362 EXTNAME: [ '.png', '.jpeg', '.jpg' ],
364 max: 2 * 1024 * 1024 // 2MB
372 TEXT: { min: 1, max: 3000 }, // Length
373 URL: { min: 3, max: 2000 } // Length
376 URL: { min: 3, max: 2000 } // Length
380 const RATES_LIMIT = {
382 WINDOW_MS: 5 * 60 * 1000, // 5 minutes
383 MAX: 15 // 15 attempts
386 WINDOW_MS: 5 * 60 * 1000, // 5 minutes
391 let VIDEO_VIEW_LIFETIME = 60000 * 60 // 1 hour
392 const VIDEO_TRANSCODING_FPS = {
396 KEEP_ORIGIN_FPS_RESOLUTION_MIN: 720 // We keep the original FPS on high resolutions (720 minimum)
399 const VIDEO_RATE_TYPES: { [ id: string ]: VideoRateType } = {
404 const FFMPEG_NICE: { [ id: string ]: number } = {
405 THUMBNAIL: 2, // 2 just for don't blocking servers
409 const VIDEO_CATEGORIES = {
424 15: 'Science & Technology',
430 // See https://creativecommons.org/licenses/?lang=en
431 const VIDEO_LICENCES = {
433 2: 'Attribution - Share Alike',
434 3: 'Attribution - No Derivatives',
435 4: 'Attribution - Non Commercial',
436 5: 'Attribution - Non Commercial - Share Alike',
437 6: 'Attribution - Non Commercial - No Derivatives',
438 7: 'Public Domain Dedication'
441 const VIDEO_LANGUAGES = buildLanguages()
443 const VIDEO_PRIVACIES = {
444 [VideoPrivacy.PUBLIC]: 'Public',
445 [VideoPrivacy.UNLISTED]: 'Unlisted',
446 [VideoPrivacy.PRIVATE]: 'Private'
449 const VIDEO_STATES = {
450 [VideoState.PUBLISHED]: 'Published',
451 [VideoState.TO_TRANSCODE]: 'To transcode',
452 [VideoState.TO_IMPORT]: 'To import'
455 const VIDEO_IMPORT_STATES = {
456 [VideoImportState.FAILED]: 'Failed',
457 [VideoImportState.PENDING]: 'Pending',
458 [VideoImportState.SUCCESS]: 'Success'
461 const VIDEO_ABUSE_STATES = {
462 [VideoAbuseState.PENDING]: 'Pending',
463 [VideoAbuseState.REJECTED]: 'Rejected',
464 [VideoAbuseState.ACCEPTED]: 'Accepted'
467 const VIDEO_MIMETYPE_EXT = {
468 'video/webm': '.webm',
472 const VIDEO_EXT_MIMETYPE = invert(VIDEO_MIMETYPE_EXT)
474 const IMAGE_MIMETYPE_EXT = {
480 const VIDEO_CAPTIONS_MIMETYPE_EXT = {
482 'application/x-subrip': '.srt'
485 const TORRENT_MIMETYPE_EXT = {
486 'application/x-bittorrent': '.torrent'
489 // ---------------------------------------------------------------------------
498 // ---------------------------------------------------------------------------
500 const SERVER_ACTOR_NAME = 'peertube'
502 const ACTIVITY_PUB = {
503 POTENTIAL_ACCEPT_HEADERS: [
504 'application/activity+json',
505 'application/ld+json',
506 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
508 ACCEPT_HEADER: 'application/activity+json, application/ld+json',
509 PUBLIC: 'https://www.w3.org/ns/activitystreams#Public',
510 COLLECTION_ITEMS_PER_PAGE: 10,
511 FETCH_PAGE_LIMIT: 100,
513 VIDEO: Object.keys(VIDEO_MIMETYPE_EXT),
514 TORRENT: [ 'application/x-bittorrent' ],
515 MAGNET: [ 'application/x-bittorrent;x-scheme-handler/magnet' ]
517 MAX_RECURSION_COMMENTS: 100,
518 ACTOR_REFRESH_INTERVAL: 3600 * 24 * 1000, // 1 day
519 VIDEO_REFRESH_INTERVAL: 3600 * 24 * 1000 // 1 day
522 const ACTIVITY_PUB_ACTOR_TYPES: { [ id: string ]: ActivityPubActorType } = {
525 APPLICATION: 'Application'
528 // ---------------------------------------------------------------------------
530 const PRIVATE_RSA_KEY_SIZE = 2048
532 // Password encryption
533 const BCRYPT_SALT_SIZE = 10
535 const USER_PASSWORD_RESET_LIFETIME = 60000 * 5 // 5 minutes
537 const USER_EMAIL_VERIFY_LIFETIME = 60000 * 60 // 60 minutes
539 const NSFW_POLICY_TYPES: { [ id: string]: NSFWPolicyType } = {
540 DO_NOT_LIST: 'do_not_list',
545 // ---------------------------------------------------------------------------
547 // Express static paths (router)
548 const STATIC_PATHS = {
549 PREVIEWS: '/static/previews/',
550 THUMBNAILS: '/static/thumbnails/',
551 TORRENTS: '/static/torrents/',
552 WEBSEED: '/static/webseed/',
553 AVATARS: '/static/avatars/',
554 VIDEO_CAPTIONS: '/static/video-captions/'
556 const STATIC_DOWNLOAD_PATHS = {
557 TORRENTS: '/download/torrents/',
558 VIDEOS: '/download/videos/'
562 let STATIC_MAX_AGE = '2h'
564 // Videos thumbnail size
565 const THUMBNAILS_SIZE = {
569 const PREVIEWS_SIZE = {
573 const AVATARS_SIZE = {
583 // Sub folders of cache directory
586 DIRECTORY: join(CONFIG.STORAGE.CACHE_DIR, 'previews'),
587 MAX_AGE: 1000 * 3600 * 3 // 3 hours
590 DIRECTORY: join(CONFIG.STORAGE.CACHE_DIR, 'video-captions'),
591 MAX_AGE: 1000 * 3600 * 3 // 3 hours
597 EXPIRES_AFTER_MS: 48 * 3600 * 1000, // 2 days
602 const ACCEPT_HEADERS = [ 'html', 'application/json' ].concat(ACTIVITY_PUB.POTENTIAL_ACCEPT_HEADERS)
604 // ---------------------------------------------------------------------------
606 const CUSTOM_HTML_TAG_COMMENTS = {
607 TITLE: '<!-- title tag -->',
608 DESCRIPTION: '<!-- description tag -->',
609 CUSTOM_CSS: '<!-- custom css tag -->',
610 OPENGRAPH_AND_OEMBED: '<!-- open graph and oembed tags -->'
613 // ---------------------------------------------------------------------------
619 // ---------------------------------------------------------------------------
621 const TRACKER_RATE_LIMITS = {
622 INTERVAL: 60000 * 5, // 5 minutes
623 ANNOUNCES_PER_IP_PER_INFOHASH: 15, // maximum announces per torrent in the interval
624 ANNOUNCES_PER_IP: 30 // maximum announces for all our torrents in the interval
627 // ---------------------------------------------------------------------------
629 // Special constants for a test instance
630 if (isTestInstance() === true) {
631 ACTOR_FOLLOW_SCORE.BASE = 20
633 REMOTE_SCHEME.HTTP = 'http'
634 REMOTE_SCHEME.WS = 'ws'
638 ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE = 2
639 ACTIVITY_PUB.ACTOR_REFRESH_INTERVAL = 10 * 1000 // 10 seconds
640 ACTIVITY_PUB.VIDEO_REFRESH_INTERVAL = 10 * 1000 // 10 seconds
642 CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max = 100 * 1024 // 100KB
644 SCHEDULER_INTERVALS_MS.badActorFollow = 10000
645 SCHEDULER_INTERVALS_MS.removeOldJobs = 10000
646 SCHEDULER_INTERVALS_MS.updateVideos = 5000
647 SCHEDULER_INTERVALS_MS.videosRedundancy = 5000
648 REPEAT_JOBS['videos-views'] = { every: 5000 }
650 REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1
652 VIDEO_VIEW_LIFETIME = 1000 // 1 second
654 JOB_ATTEMPTS['email'] = 1
656 CACHE.VIDEO_CAPTIONS.MAX_AGE = 3000
659 updateWebserverConfig()
661 // ---------------------------------------------------------------------------
665 VIDEO_CAPTIONS_MIMETYPE_EXT,
677 LAST_MIGRATION_VERSION,
679 CUSTOM_HTML_TAG_COMMENTS,
680 BROADCAST_CONCURRENCY,
687 PRIVATE_RSA_KEY_SIZE,
688 ROUTE_CACHE_LIFETIME,
693 TORRENT_MIMETYPE_EXT,
697 ACTIVITY_PUB_ACTOR_TYPES,
706 VIDEO_TRANSCODING_FPS,
710 USER_PASSWORD_RESET_LIFETIME,
711 USER_EMAIL_VERIFY_LIFETIME,
714 SCHEDULER_INTERVALS_MS,
716 STATIC_DOWNLOAD_PATHS,
719 CRAWL_REQUEST_CONCURRENCY,
720 JOB_COMPLETED_LIFETIME,
726 // ---------------------------------------------------------------------------
728 function getLocalConfigFilePath () {
729 const configSources = config.util.getConfigSources()
730 if (configSources.length === 0) throw new Error('Invalid config source.')
732 let filename = 'local'
733 if (process.env.NODE_ENV) filename += `-${process.env.NODE_ENV}`
734 if (process.env.NODE_APP_INSTANCE) filename += `-${process.env.NODE_APP_INSTANCE}`
736 return join(dirname(configSources[ 0 ].name), filename + '.json')
739 function updateWebserverConfig () {
740 CONFIG.WEBSERVER.URL = sanitizeUrl(CONFIG.WEBSERVER.SCHEME + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT)
741 CONFIG.WEBSERVER.HOST = sanitizeHost(CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT, REMOTE_SCHEME.HTTP)
744 function buildVideosRedundancy (objs: VideosRedundancy[]): VideosRedundancy[] {
747 return objs.map(obj => Object.assign(obj, { size: bytes.parse(obj.size) }))
750 function buildLanguages () {
751 const iso639 = require('iso-639-3')
753 const languages: { [ id: string ]: string } = {}
755 const additionalLanguages = {
756 'sgn': true, // Sign languages (macro language)
757 'ase': true, // American sign language
758 'sdl': true, // Arabian sign language
759 'bfi': true, // British sign language
760 'bzs': true, // Brazilian sign language
761 'csl': true, // Chinese sign language
762 'cse': true, // Czech sign language
763 'dsl': true, // Danish sign language
764 'fsl': true, // French sign language
765 'gsg': true, // German sign language
766 'pks': true, // Pakistan sign language
767 'jsl': true, // Japanese sign language
768 'sfs': true, // South African sign language
769 'swl': true, // Swedish sign language
770 'rsl': true, // Russian sign language: true
772 'epo': true, // Esperanto
773 'tlh': true, // Klingon
774 'jbo': true, // Lojban
775 'avk': true // Kotava
778 // Only add ISO639-1 languages and some sign languages (ISO639-3)
781 return (l.iso6391 !== null && l.type === 'living') ||
782 additionalLanguages[l.iso6393] === true
784 .forEach(l => languages[l.iso6391 || l.iso6393] = l.name)
786 // Override Occitan label
787 languages['oc'] = 'Occitan'
792 export function reloadConfig () {
794 function directory () {
795 if (process.env.NODE_CONFIG_DIR) {
796 return process.env.NODE_CONFIG_DIR
799 return join(root(), 'config')
803 for (const fileName in require.cache) {
804 if (-1 === fileName.indexOf(directory())) {
808 delete require.cache[fileName]
811 delete require.cache[require.resolve('config')]
816 config = require('config')
818 updateWebserverConfig()