-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document limitation of uri option in non-global drush config file #6220
Comments
You can specify this as a global option in a drush config file or in an equivalent environment variable |
Thanks for a fast answer. On a server, I tried adding a
PS. I was puzzled, when I saw in DDEV that Site URI was populated correctly ... but then realized, that's because it's defined in |
Also, I just posted this in Allow defining a base URL since it looks to me like the base URL can be seen by Drupal 10 ... Why cannot Drush also see it then?
From https://www.drupal.org/project/drupal/issues/3504766#comment-15976324 |
'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. |
I see, thanks for a swift and thorough explanation. To me, the question is then -- if Drupal can mirror back the host I am currently using, why cannot Drush also do this? It would make every day use much easier for Drush users. I do think also, that your explanation why I failed is important, since probably many others have tried, but also failed ... so perhaps it can be added to the Drush config doc page? I will now try to get it working based on your explanation, which I am grateful for. But it does seem extra difficult, so an automatic detection of base URL would be an amazing new feature, if at all possible. |
Because Drupal is accessed via a web browser, which inherently presents its hostname. A CLI request does not. Yes, more docs would be helpful. They should point to the documented env variables approach. |
Thanks, I'll have a look at it. Perhaps you can reopen this issue, since it needs work? Though, it's not clear to me in which file I am supposed to put |
Environment variables are an operating system feature, unrelated to Drush. |
Site URI
(default domain) for a Drupal 10 site?
I am happy to link to somewhere on the web that describes what env variables are and how to set them |
Sure, that would be great. Thanks. |
The easiest would be, if the minimal required steps to set this up was included in the documentation ... But I am also all right with piecing it together, step-by-step ... |
Like I wrote, also -- it's not just about setting up a environment variable, but how to connect it all, and have Drush discover it. I add this, since I sense a " Let me Google that for you"-tone in your last comment, but I could be mistaken. |
PHP already reads environment variables. So if you set a properly named env variable, Drush will discover it. No more work on the user's part is needed. |
Ok, I am ready for a link, where I can read how to do it, and then try to make it work. I tried adding a |
You mean that it didnt get picked up by your operating system. Drush is not involved in setting env variables - It only reads what from the environment you have configured elsewhere. You can see the env variables are set via the |
Thanks! Assuming that a lot of Drupal web sites are hosted on for example Debian, do you know how I would set it up in that environment? If you don't know, maybe someone else can help out with clearing this up? Ideally, we can end up finding the minimal steps, which results in base URL being defined as an environment variable. I will then add the steps to the Drush documentation page on drupal.org: |
Is it something like the below example you mean? (Made in DDEV) That is not a great method, since it only works with a single Drupal installation present, and in a lot of set ups, there will be more than one Drupal 10 installation on the server.
|
Well, DDDEV handles this for you. It already sets DRUSH_OPTIONS_URI. Your doc works for Unix. Mac shell is ZSH these days so its a different file. And Windows has its own permutations. And Docker based hosts have own ways to set env variables. For the multiple codebases on same server situation, I have found https://direnv.net/ helpful. With this, your env variables can vary depending on the directory you are in when you issue a CLI request. |
Yes I know, I just used DDEV as a proof of concept, showing the steps taken, so that others could easily replicate them. The aim of this issue is to document how to set the base URL on a production server with multiple Drupal 10 installations. I didn't specify this in the Issue Summary, since I didn't think it wasn't relevant at that point, but I'll update the Issue Summary. Thanks for the link to Direnv which works well, and we could add info about it to the documentation. I installed Direnv and defined a new base URL in a
Test if it works:
|
I think direnv would work inside of ddev container. It would overwrite the DRUSH_OPTIONS_URI value provided by DDEV itself. I could see a multi-site wanting to use it. |
…multiple Drupal 10 installations ## The Issue - Fixes drush-ops#6220
I tried in DDEV, but it got ignored, as far as I could tell ... but I didn't spend a lot of time experimenting with it. I have created a PR which adds info about Direnv. |
Existing documentation
What are you attempting to do
Run
drush user:login
and automatically have the domain defined, via a configuration file,settings.php
, or some other way.The
drush user:login
command could be in the top 5 most used commands, yet you have to append the domain, likedrush user:login -l https://example.org
, which gets tiring ...In Drupal 7 it was possible to set the default domain for a Drupal project in
settings.php
. DDEV sets a base URL by definingDRUSH_OPTIONS_URI
in its Docker files, which works well.However, setting a base URL on a production server with multiple Drupal 10 installations is difficult.
It would be great if a method to set the
site URI
for a Drupal 10 site was defined, I currently get this:In what way is the existing documentation unclear or incomplete
I cannot find a clear list of steps on how to set the
site URI
for a Drupal 10 project, on a server hosting multiple Drupal 10 sites.What should the documentation say instead?
It should contain a method on how to set the default domain for a Drupal 10 project.
As a follow up issue, a Drupal 11 issue could be created, suggesting that a new
URI
field was added under Basic Site settings (/admin/config/system/site-information
) allowing the user to set the default domain. If it was added, I guess it could then also be set viasettings.php
, since it would then be an accessible variable.The text was updated successfully, but these errors were encountered: