mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-13 18:32:41 +01:00
4425903480
Summary: Fixes T2293. We currently hard-require this in setup. We do not need to; we don't actually need it until we start running daemons. Move it to post-install and provide more guidance. We could make this even easier in the future, but we'd need to special case it, since it's dangerous to let it be set to any value (if you set it to the wrong value, you can't log in). We could safely have a workflow which writes the current request URI into the database configuration, or a two-stage workflow where we set the URI and then verify it, but these both imply some special casing and complication. This should be a step forward from where we are today, regardless. Test Plan: Removed "phabricator.base-uri" from my configuration. Verified Phabricator still works. Without "phabricator.base-uri" configured, logged in from multiple host names (127.0.0.1:8080, local.aphront.com:8080). Configured "phabricator.base-uri". Verified my unblessed session no longer worked. Verified setup issue went away. Reviewers: btrahan, vrana Reviewed By: btrahan CC: aran Maniphest Tasks: T2293 Differential Revision: https://secure.phabricator.com/D4580
47 lines
1.5 KiB
PHP
47 lines
1.5 KiB
PHP
<?php
|
|
|
|
final class PhabricatorSetupCheckBaseURI extends PhabricatorSetupCheck {
|
|
|
|
protected function executeChecks() {
|
|
$base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri');
|
|
if ($base_uri) {
|
|
return;
|
|
}
|
|
|
|
$base_uri_guess = PhabricatorEnv::getRequestBaseURI();
|
|
|
|
$summary = pht(
|
|
'The base URI for this install is not configured. Configuring it will '.
|
|
'improve security and enable features.');
|
|
|
|
$message = pht(
|
|
'The base URI for this install is not configured. Configuring it will '.
|
|
'improve security and allow background processes (like daemons and '.
|
|
'scripts) to generate links.'.
|
|
"\n\n".
|
|
'You should set the base URI to the URI you will use to access '.
|
|
'Phabricator, like "http://phabricator.example.com/".'.
|
|
"\n\n".
|
|
'Include the protocol (http or https), domain name, and port number if '.
|
|
'you are using a port other than 80 (http) or 443 (https).'.
|
|
"\n\n".
|
|
'Based on this request, it appears that the correct setting is:'.
|
|
"\n\n".
|
|
'%s'.
|
|
"\n\n".
|
|
'To configure the base URI, run the command shown below.',
|
|
$base_uri_guess);
|
|
|
|
$this
|
|
->newIssue('config.phabricator.base-uri')
|
|
->setShortName(pht('No Base URI'))
|
|
->setName(pht("Base URI Not Configured"))
|
|
->setSummary($summary)
|
|
->setMessage($message)
|
|
->addCommand(
|
|
csprintf(
|
|
'<tt>phabricator/ $</tt> '.
|
|
'./bin/config set phabricator.base-uri %s',
|
|
$base_uri_guess));
|
|
}
|
|
}
|