aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/checker.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-21 18:29:28 +0200
committerChocobozzz <me@florianbigard.com>2018-06-21 18:36:08 +0200
commit23687332e6d7972c6a0eee30ce9056e45dec022b (patch)
treee29e6128582e69ca815f294aa9c269dcc20ff372 /server/initializers/checker.ts
parent2336a0e7fb5d3d4c6d1489e6882b1fa24975d8c7 (diff)
downloadPeerTube-23687332e6d7972c6a0eee30ce9056e45dec022b.tar.gz
PeerTube-23687332e6d7972c6a0eee30ce9056e45dec022b.tar.zst
PeerTube-23687332e6d7972c6a0eee30ce9056e45dec022b.zip
Improve update host script and add warning if AP urls are invalid
Diffstat (limited to 'server/initializers/checker.ts')
-rw-r--r--server/initializers/checker.ts25
1 files changed, 24 insertions, 1 deletions
diff --git a/server/initializers/checker.ts b/server/initializers/checker.ts
index 6259c7b6c..d5402098f 100644
--- a/server/initializers/checker.ts
+++ b/server/initializers/checker.ts
@@ -3,6 +3,28 @@ import { promisify0 } from '../helpers/core-utils'
3import { UserModel } from '../models/account/user' 3import { UserModel } from '../models/account/user'
4import { ApplicationModel } from '../models/application/application' 4import { ApplicationModel } from '../models/application/application'
5import { OAuthClientModel } from '../models/oauth/oauth-client' 5import { OAuthClientModel } from '../models/oauth/oauth-client'
6import { parse } from 'url'
7import { CONFIG } from './constants'
8import { logger } from '../helpers/logger'
9import { getServerActor } from '../helpers/utils'
10
11async function checkActivityPubUrls () {
12 const actor = await getServerActor()
13
14 const parsed = parse(actor.url)
15 if (CONFIG.WEBSERVER.HOST !== parsed.host) {
16 const NODE_ENV = config.util.getEnv('NODE_ENV')
17 const NODE_CONFIG_DIR = config.util.getEnv('NODE_CONFIG_DIR')
18
19 logger.warn(
20 'It seems PeerTube was started (and created some data) with another domain name. ' +
21 'This means you will not be able to federate! ' +
22 'Please use %s %s npm run update-host to fix this.',
23 NODE_CONFIG_DIR ? `NODE_CONFIG_DIR=${NODE_CONFIG_DIR}` : '',
24 NODE_ENV ? `NODE_ENV=${NODE_ENV}` : ''
25 )
26 }
27}
6 28
7// Some checks on configuration files 29// Some checks on configuration files
8// Return an error message, or null if everything is okay 30// Return an error message, or null if everything is okay
@@ -95,5 +117,6 @@ export {
95 checkMissedConfig, 117 checkMissedConfig,
96 clientsExist, 118 clientsExist,
97 usersExist, 119 usersExist,
98 applicationExist 120 applicationExist,
121 checkActivityPubUrls
99} 122}