diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-21 18:29:28 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-21 18:36:08 +0200 |
commit | 23687332e6d7972c6a0eee30ce9056e45dec022b (patch) | |
tree | e29e6128582e69ca815f294aa9c269dcc20ff372 /server/initializers/checker.ts | |
parent | 2336a0e7fb5d3d4c6d1489e6882b1fa24975d8c7 (diff) | |
download | PeerTube-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.ts | 25 |
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' | |||
3 | import { UserModel } from '../models/account/user' | 3 | import { UserModel } from '../models/account/user' |
4 | import { ApplicationModel } from '../models/application/application' | 4 | import { ApplicationModel } from '../models/application/application' |
5 | import { OAuthClientModel } from '../models/oauth/oauth-client' | 5 | import { OAuthClientModel } from '../models/oauth/oauth-client' |
6 | import { parse } from 'url' | ||
7 | import { CONFIG } from './constants' | ||
8 | import { logger } from '../helpers/logger' | ||
9 | import { getServerActor } from '../helpers/utils' | ||
10 | |||
11 | async 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 | } |