mirror of
https://framagit.org/framasoft/peertube/search-index/
synced 2025-01-24 16:30:56 +01:00
69 lines
1.5 KiB
TypeScript
69 lines
1.5 KiB
TypeScript
import * as config from 'config'
|
|
import { isTestInstance } from '../helpers/core-utils'
|
|
|
|
const API_VERSION = 'v1'
|
|
|
|
const CONFIG = {
|
|
LISTEN: {
|
|
PORT: config.get<number>('listen.port')
|
|
},
|
|
ELASTIC_SEARCH: {
|
|
HOSTNAME: config.get<string>('elastic_search.hostname'),
|
|
PORT: config.get<number>('elastic_search.port'),
|
|
INDEXES: {
|
|
VIDEOS: config.get<string>('elastic_search.indexes.videos'),
|
|
CHANNELS: config.get<string>('elastic_search.indexes.channels')
|
|
}
|
|
},
|
|
LOG: {
|
|
LEVEL: config.get<string>('log.level')
|
|
},
|
|
INSTANCES_INDEX: {
|
|
URL: config.get<string>('instances-index.url')
|
|
},
|
|
WHITELIST: {
|
|
ENABLED: config.get<boolean>('whitelist.enabled'),
|
|
HOSTS: config.get<string[]>('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
|
|
}
|