Add URL in search index
This commit is contained in:
parent
fdbf6ede5f
commit
dd765cecbf
|
@ -1,12 +1,15 @@
|
|||
import * as Bluebird from 'bluebird'
|
||||
import * as request from 'request'
|
||||
import { waitMs } from './core-utils'
|
||||
import { CONFIG } from 'server/initializers/constants'
|
||||
|
||||
function doRequest <T> (
|
||||
requestOptions: request.CoreOptions & request.UriOptions
|
||||
): Bluebird<{ response: request.RequestResponse, body: T }> {
|
||||
if (!(requestOptions.headers)) requestOptions.headers = {}
|
||||
requestOptions.headers['User-Agent'] = 'PeerTube indexer'
|
||||
|
||||
const webserverUrl = CONFIG.WEBSERVER.SCHEME + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT
|
||||
requestOptions.headers['User-Agent'] = `PeerTube search index (+${webserverUrl})`
|
||||
|
||||
return new Bluebird<{ response: request.RequestResponse, body: T }>((res, rej) => {
|
||||
request(requestOptions, (err, response, body) => err ? rej(err) : res({ response, body }))
|
||||
|
|
|
@ -7,6 +7,11 @@ const CONFIG = {
|
|||
LISTEN: {
|
||||
PORT: config.get<number>('listen.port')
|
||||
},
|
||||
WEBSERVER: {
|
||||
SCHEME: config.get<boolean>('webserver.https') === true ? 'https' : 'http',
|
||||
HOSTNAME: config.get<string>('webserver.hostname'),
|
||||
PORT: config.get<number>('webserver.port')
|
||||
},
|
||||
ELASTIC_SEARCH: {
|
||||
HOSTNAME: config.get<string>('elastic_search.hostname'),
|
||||
PORT: config.get<number>('elastic_search.port'),
|
||||
|
|
Loading…
Reference in New Issue