- Issue created by @ressa
- π©π°Denmark ressa Copenhagen
It just dawned on me that "Default front page" shows the actual base URL ...
I wonder why that variable is not then used in Drush and XML Sitemap ( β¨ Default Base URL Does not export as configuration Active )?
- π©π°Denmark ressa Copenhagen
My question about "Default front page" was kindly answered by @weitzman on Github:
'Default front page' is just mirroring back to you the host you are currently using. There is no stored Drupal setting or config for this.
- π©π°Denmark ressa Copenhagen
Thanks for the review @smustgrave, it's very much appreciated. Like I wrote, I know very little about writing a test, but am open for any suggestions, to use as a starting point.
What do you think about the proposal itself?
- πΊπΈUnited States smustgrave
Would have to do some research to see why/where it was removed if it existed in D7
Will dig around the tests though
- π¬π§United Kingdom longwave UK
ddev manages this without a setting, I don't know how - I assume either an environment variable or something in the settings.php include - but if that's possible I don't see why we need this feature.
Also, how will this work on sites that listen on multiple domain names?
- πΊπΈUnited States smustgrave
I assume some variable because lando does not.
Iβm a ddev guy just speaking from experience
- π©π°Denmark ressa Copenhagen
That's true, DDEV takes care of this for local development, and I have updated the Issue Summary to clarify that this feature request is aimed at the web server. It looks like you need to configure this in Lando (https://docs.lando.dev/plugins/drupal/tooling.html#default-url-setup)
About multiple domain names -- this setting is optional. But I guess this feature could be expanded, maybe via a contrib module to support multisites?
- π©π°Denmark ressa Copenhagen
Adding link in the Issue Summary to the complicated workaround using Direnv: Drush > Set base URL for multiple Drupal installations on server β .
- π©π°Denmark ressa Copenhagen
@smustgrave: I am still open for a suggestion for a test, to use as a starting point :)
To give the issue some traction and fresh eyes too give this a look over, and general feedback, I'll change Status, and work on the test, when an example has been suggested.
- π©π°Denmark ressa Copenhagen
I made a simple test.
@longwave, you asked:
ddev manages this without a setting, I don't know how - I assume either an environment variable or something in the settings.php include - but if that's possible I don't see why we need this feature.
So, we got settled that DDEV does this via its Docker settings (see Issue Summary).
I think the question is, what solution would you or @smustgrave propose to an Ambitious Site Builder with limited Linux skills on shared hosting, maybe even with multiple Drupal installations on the same server, who miss having a base URL?
- π¨πSwitzerland znerol
I'm confused. Is this setting supposed to have any influence on url generation? Like, e.g., on absolute url in emails sent during a cron run? If yes, how would that work with the current implementation? If no, why add it in the first place?
- π©π°Denmark ressa Copenhagen
I have outlined the usage in the Issue summary, and Drush and XML Sitemap are potential users of this, there are probably others?
- π«π·France andypost
It could be tricky with domain β contrib module and
trusted_host_patterns
setting - π¨πSwitzerland znerol
I'd like to avoid the pitfall of wishful/magic thinking here. If drush is supposed to use this feature, then there should be a PoC for drush which demonstrates how this is supposed to be integrated.
Also if all of the projects mentioned in the issue summary and the comments which are supposed to profit from that feature need to be modified, how do we ensure that this is implemented in a consistent way across the board?
- π¨πSwitzerland znerol
Also please study drush configuration docs, especially the Global options section. If the
options.uri
is configured, any drush invocation will use that as the default value for--uri
. This is useful for sites not running on any of the specialized hosting packages (or ddev). - π©π°Denmark ressa Copenhagen
Solve in Drush
I agree about avoiding pitfalls and magical thinking, ideally this would best be solved in Drush in the first place.
Please see the corresponding Drush issue Document limitation of uri option in non-global drush config file #6220, where I just left a question, about how domains are included in security alert emails. That method might work for getting Site URI as well?
Feel free to jump in and suggest a solution directly in Drush :)
Global option -- complicated to set up and limited to a single Drupal instance on server
Thanks for the link to Global option's, I recently updated that page :) Also, this method only works for a single Drupal installation. The solution for more than one Drupal installation on a server is complex, and requires sudo access (section created by me):
For a web server with multiple Drupal installations, and the option of installing programs, see Drush > Set base URL for multiple Drupal installations on server β .
Let's make life easier for Drupal users, who are not Bash experts, and can't install programs
The reality is this: Many Drupal users have to append the domain, and cannot run simply
drush uli
, and we should fix this, either in Drupal core or Drush. The workarounds are too complex. Also, mostly you cannot install programs on managed hosting.I think we should focus on the use case for the Ambitious Site Builder, and make running Drupal easier, and have updated the Issue Summary, to clarify the end goal.
- π«π·France andypost
I'm sure it must be fixed in drush instead of core, moreover I'm using to provide URL for drush via command line instead of global option specifically for multi-site clients to point which site I'm contacting. Without it drush unable to select proper "sites/domain.tld"
PS so many efforts put on removal of base_url from core... so please don't wire it again
- π¨πSwitzerland znerol
If you host a single site on a single deployment: Specify
options.uri
indrush.yml
and place that file in one of the following locationssites/all/drush
,WEBROOT/drush
, orPROJECTROOT/drush
. This will be used as the fallback if nothing else is specified (see drush configuration docs - directories and discovery.Look into site aliases if you want to do something more complicated. E.g., one site serving multiple domains (example.com, example.org, example.net) or staged deployment (dev, test, staging, production).
Do not attempt to use environment variables unless you are operating in a containerized environment.
- π©π°Denmark ressa Copenhagen
Thanks for weighing in @andypost -- though it should not be required, only optional, same as for example "Error pages > Default 403 (access denied) page". Also, since it's a config variable, the user can use it from settings.php only, not the GUI.
Anyway, about solving it in Drush, I agree -- and you should also feel free to join in the Drush issue, and find a permanent solution there:
https://github.com/drush-ops/drush/issues/6220 - π©π°Denmark ressa Copenhagen
@znerol: I know there are solutions to this, but they are too complicated, and require deep Bash knowledge. If you have two web sites, the solution becomes extremely complicated.
Fundamentally, this issue is not about documenting Bash configuration, but finding a solution, so it's not necessary to do it in the first place.
The Drupal community is shooting itself in the foot, by making solving this simple but reasonable wish way too hard.
As a user, getting Drush ready should be as easy as running
composer require drush/drush
and then rundrush uli
, without doing any Bash configuration.If you all agree that Base URL in Drupal is not the right path, can we please try to find a user friendly solution to this in https://github.com/drush-ops/drush/issues/6220?
I am looking forward to your input :)
- π©π°Denmark ressa Copenhagen
I have created a fresh Drush issue, dedicated to finding a solution in Drush for this, feel free to share thoughts, MR's, etc.:
Run drush user:login and automatically have the domain detected #6254
- π©π°Denmark ressa Copenhagen
@andypost and @znerol, you were correct. It could be solved in Drush, and pretty easily in fact (solution found in Github PR), simply by adding a
drush/drush.yml
file in each project with this:options: uri: 'https://example.org'
The crucial point is, that this solution works well, even if the user has multiple Drupal installations on the same server, for example on a managed web hotel.