]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/server-commands/server/server.ts
Fix CI using 127.0.0.1 for tests
[github/Chocobozzz/PeerTube.git] / shared / server-commands / server / server.ts
index 7096faf21d50d2f976e6cb941014120e17cbd038..ae1395a74246002bb34fbeabe846b729309958b6 100644 (file)
@@ -36,6 +36,7 @@ import {
   StreamingPlaylistsCommand,
   VideosCommand,
   VideoStudioCommand,
+  VideoTokenCommand,
   ViewsCommand
 } from '../videos'
 import { CommentsCommand } from '../videos/comments-command'
@@ -145,6 +146,7 @@ export class PeerTubeServer {
   videoStats?: VideoStatsCommand
   views?: ViewsCommand
   twoFactor?: TwoFactorCommand
+  videoToken?: VideoTokenCommand
 
   constructor (options: { serverNumber: number } | { url: string }) {
     if ((options as any).url) {
@@ -177,9 +179,9 @@ export class PeerTubeServer {
     this.rtmpsPort = this.parallel ? this.randomRTMP() : 1937
     this.port = 9000 + this.internalServerNumber
 
-    this.url = `http://localhost:${this.port}`
-    this.host = `localhost:${this.port}`
-    this.hostname = 'localhost'
+    this.url = `http://127.0.0.1:${this.port}`
+    this.host = `127.0.0.1:${this.port}`
+    this.hostname = '127.0.0.1'
   }
 
   setUrl (url: string) {
@@ -257,7 +259,7 @@ export class PeerTubeServer {
 
       const onPeerTubeExit = () => rej(new Error('Process exited:\n' + aggregatedLogs))
       const onParentExit = () => {
-        if (!this.app || !this.app.pid) return
+        if (!this.app?.pid) return
 
         try {
           process.kill(self.app.pid)
@@ -427,5 +429,6 @@ export class PeerTubeServer {
     this.videoStats = new VideoStatsCommand(this)
     this.views = new ViewsCommand(this)
     this.twoFactor = new TwoFactorCommand(this)
+    this.videoToken = new VideoTokenCommand(this)
   }
 }