import { copy } from 'fs-extra'
import { join } from 'path'
import { root } from '@server/helpers/core-utils'
-import { randomInt } from '../../core-utils/miscs/miscs'
-import { VideoChannel } from '../../models/videos'
+import { randomInt } from '@shared/core-utils'
+import { Video, VideoChannel, VideoCreateResult, VideoDetails } from '../../models/videos'
import { BulkCommand } from '../bulk'
import { CLICommand } from '../cli'
import { CustomPagesCommand } from '../custom-pages'
export type RunServerOptions = {
hideLogs?: boolean
- execArgv?: string[]
+ nodeArgs?: string[]
+ peertubeArgs?: string[]
}
export class PeerTubeServer {
channel?: VideoChannel
- video?: {
- id: number
- uuid: string
- shortUUID: string
- name?: string
- url?: string
-
- account?: {
- name: string
- }
-
- embedPath?: string
- }
+ video?: Video
+ videoCreated?: VideoCreateResult
+ videoDetails?: VideoDetails
videos?: { id: number, uuid: string }[]
}
this.port = parseInt(parsed.port)
}
- async flushAndRun (configOverride?: Object, args = [], options: RunServerOptions = {}) {
+ async flushAndRun (configOverride?: Object, options: RunServerOptions = {}) {
await ServersCommand.flushTests(this.internalServerNumber)
- return this.run(configOverride, args, options)
+ return this.run(configOverride, options)
}
- async run (configOverrideArg?: any, args = [], options: RunServerOptions = {}) {
+ async run (configOverrideArg?: any, options: RunServerOptions = {}) {
// These actions are async so we need to be sure that they have both been done
const serverRunString = {
'HTTP server listening': false
silent: true,
env,
detached: true,
- execArgv: options.execArgv || []
+ execArgv: options.nodeArgs || []
}
return new Promise<void>(res => {
const self = this
- this.app = fork(join(root(), 'dist', 'server.js'), args, forkOptions)
+ this.app = fork(join(root(), 'dist', 'server.js'), options.peertubeArgs || [], forkOptions)
this.app.stdout.on('data', function onStdout (data) {
let dontContinue = false