import * as config from 'config' import { isTestInstance } from '../helpers/core-utils' const API_VERSION = 'v1' const CONFIG = { LISTEN: { PORT: config.get('listen.port') }, ELASTIC_SEARCH: { HOSTNAME: config.get('elastic_search.hostname'), PORT: config.get('elastic_search.port'), INDEXES: { VIDEOS: config.get('elastic_search.indexes.videos'), CHANNELS: config.get('elastic_search.indexes.channels') } }, LOG: { LEVEL: config.get('log.level') }, INSTANCES_INDEX: { URL: config.get('instances-index.url') }, WHITELIST: { ENABLED: config.get('whitelist.enabled'), HOSTS: config.get('whitelist.hosts') } } const SORTABLE_COLUMNS = { VIDEOS_SEARCH: [ 'name', 'duration', 'createdAt', 'publishedAt', 'views', 'likes', 'match' ], CHANNELS_SEARCH: [ 'match', 'displayName', 'createdAt' ] } const PAGINATION_COUNT_DEFAULT = 20 const SCHEDULER_INTERVALS_MS = { videosIndexer: 60000 * 60 * 24 // 24 hours } const INDEXER_COUNT = { VIDEOS: 10 } const INDEXER_CONCURRENCY = 3 const INDEXER_QUEUE_CONCURRENCY = 3 const REQUESTS = { MAX_RETRIES: 10, WAIT: 10000 // 10 seconds } if (isTestInstance()) { SCHEDULER_INTERVALS_MS.videosIndexer = 30000 } export { CONFIG, API_VERSION, PAGINATION_COUNT_DEFAULT, SORTABLE_COLUMNS, INDEXER_QUEUE_CONCURRENCY, SCHEDULER_INTERVALS_MS, INDEXER_CONCURRENCY, INDEXER_COUNT, REQUESTS }