-import * as bytes from 'bytes'
+import bytes from 'bytes'
import { IConfig } from 'config'
import decache from 'decache'
import { dirname, join } from 'path'
PREFIX: config.get<string>('email.subject.prefix') + ' '
}
},
+
+ CLIENT: {
+ VIDEOS: {
+ MINIATURE: {
+ get PREFER_AUTHOR_DISPLAY_NAME () { return config.get<boolean>('client.videos.miniature.prefer_author_display_name') }
+ }
+ }
+ },
+
STORAGE: {
TMP_DIR: buildPath(config.get<string>('storage.tmp')),
ACTOR_IMAGES: buildPath(config.get<string>('storage.avatars')),
PLUGINS_DIR: buildPath(config.get<string>('storage.plugins')),
CLIENT_OVERRIDES_DIR: buildPath(config.get<string>('storage.client_overrides'))
},
+ OBJECT_STORAGE: {
+ ENABLED: config.get<boolean>('object_storage.enabled'),
+ MAX_UPLOAD_PART: bytes.parse(config.get<string>('object_storage.max_upload_part')),
+ ENDPOINT: config.get<string>('object_storage.endpoint'),
+ REGION: config.get<string>('object_storage.region'),
+ CREDENTIALS: {
+ ACCESS_KEY_ID: config.get<string>('object_storage.credentials.access_key_id'),
+ SECRET_ACCESS_KEY: config.get<string>('object_storage.credentials.secret_access_key')
+ },
+ VIDEOS: {
+ BUCKET_NAME: config.get<string>('object_storage.videos.bucket_name'),
+ PREFIX: config.get<string>('object_storage.videos.prefix'),
+ BASE_URL: config.get<string>('object_storage.videos.base_url')
+ },
+ STREAMING_PLAYLISTS: {
+ BUCKET_NAME: config.get<string>('object_storage.streaming_playlists.bucket_name'),
+ PREFIX: config.get<string>('object_storage.streaming_playlists.prefix'),
+ BASE_URL: config.get<string>('object_storage.streaming_playlists.base_url')
+ }
+ },
WEBSERVER: {
SCHEME: config.get<boolean>('webserver.https') === true ? 'https' : 'http',
WS: config.get<boolean>('webserver.https') === true ? 'wss' : 'ws',
URL: config.get<string>('peertube.check_latest_version.url')
}
},
+ WEBADMIN: {
+ CONFIGURATION: {
+ EDITION: {
+ ALLOWED: config.get<boolean>('webadmin.configuration.edition.allowed')
+ }
+ }
+ },
ADMIN: {
get EMAIL () { return config.get<string>('admin.email') }
},
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') },
+ get MINIMUM_AGE () { return config.get<number>('signup.minimum_age') },
FILTERS: {
CIDR: {
get WHITELIST () { return config.get<string[]>('signup.filters.cidr.whitelist') },
// ---------------------------------------------------------------------------
function getLocalConfigFilePath () {
- const configSources = config.util.getConfigSources()
- if (configSources.length === 0) throw new Error('Invalid config source.')
+ const localConfigDir = getLocalConfigDir()
let filename = 'local'
if (process.env.NODE_ENV) filename += `-${process.env.NODE_ENV}`
if (process.env.NODE_APP_INSTANCE) filename += `-${process.env.NODE_APP_INSTANCE}`
- return join(dirname(configSources[0].name), filename + '.json')
+ return join(localConfigDir, filename + '.json')
+}
+
+function getLocalConfigDir () {
+ if (process.env.PEERTUBE_LOCAL_CONFIG) return process.env.PEERTUBE_LOCAL_CONFIG
+
+ const configSources = config.util.getConfigSources()
+ if (configSources.length === 0) throw new Error('Invalid config source.')
+
+ return dirname(configSources[0].name)
}
function buildVideosRedundancy (objs: any[]): VideosRedundancyStrategy[] {
export function reloadConfig () {
- function getConfigDirectory () {
+ function getConfigDirectories () {
if (process.env.NODE_CONFIG_DIR) {
- return process.env.NODE_CONFIG_DIR
+ return process.env.NODE_CONFIG_DIR.split(':')
}
- return join(root(), 'config')
+ return [ join(root(), 'config') ]
}
function purge () {
- const directory = getConfigDirectory()
+ const directories = getConfigDirectories()
for (const fileName in require.cache) {
- if (fileName.includes(directory) === false) {
+ if (directories.some((dir) => fileName.includes(dir)) === false) {
continue
}