diff options
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 | } |