Skip to content
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

DDEV should not manage CRAFT_WEB_URL in .env (Craft CMS) #5665

Closed
1 task done
timkelty opened this issue Dec 30, 2023 · 4 comments · Fixed by #5668
Closed
1 task done

DDEV should not manage CRAFT_WEB_URL in .env (Craft CMS) #5665

timkelty opened this issue Dec 30, 2023 · 4 comments · Fixed by #5668

Comments

@timkelty
Copy link
Contributor

timkelty commented Dec 30, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Output of ddev debug test

Expand `ddev debug test` diagnostic information
All project containers are now ready.
Successfully started tryddevproject-18527
Project can be reached at https://tryddevproject-18527.ddev.site https://127.0.0.1:32782
======== Curl of site from inside container:
HTTP/1.1 200 OK
Server: nginx
Date: Sat, 30 Dec 2023 19:21:59 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding

======== curl -I of http://tryddevproject-18527.ddev.site from outside:
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Date: Sat, 30 Dec 2023 19:21:59 GMT
Server: nginx
Vary: Accept-Encoding

======== full curl of http://tryddevproject-18527.ddev.site from outside:
Success accessing database... db via TCP/IP
ddev is working. You will want to delete this project with 'ddev delete -Oy tryddevproject-18527'
======== Project ownership on host:
drwxr-xr-x  4 timkelty  staff  128 Dec 30 14:21 ../tryddevproject-18527
======== Project ownership in container:
drwxr-xr-x 4 timkelty dialout 128 Dec 30 19:21 /var/www/html
======== In-container filesystem:
Filesystem     Type     1K-blocks      Used Available Use% Mounted on
mac            virtiofs 971350180 817160468 154189712  85% /var/www/html
======== curl again of tryddevproject-18527 from host:
Success accessing database... db via TCP/IP
ddev is working. You will want to delete this project with 'ddev delete -Oy tryddevproject-18527'
Thanks for running the diagnostic. It was successful.
Please provide the output of this script in a new gist at gist.github.com
Running ddev launch in 5 seconds

Expected Behavior

Setting CRAFT_WEB_URL to DDEV's primary URL is too prescriptive for Craft CMS and breaks multi-site functionality.

I should be able to ddev start a Craft CMS project, and not have the @web alias overwritten.

Actual Behavior

On every start, CRAFT_WEB_URL is written to .env file, using the DDEV primary url, potentially breaking any Craft multisite installation.

Steps To Reproduce

No response

Anything else?

This was added as a result of #4650.

In that discussion, I was mistaken and thought these would only be added initally (ddev config) as a starting point/suggestion, when in fact they are added every start.

For further clarification, CRAFT_WEB_URL is meant to be configured to the hostname from the current request. If you are using DDEV's additional_hostnames, this will not be accurate, so should not be set.

@timkelty timkelty changed the title DDEV should not manage URLs in .env (Craft CMS) DDEV should not manage CRAFT_WEB_URL in .env (Craft CMS) Dec 30, 2023
@rfay
Copy link
Member

rfay commented Dec 31, 2023

I do with there was a .env.local in Craft CMS.

I'm sure you know that you can tell DDEV not to manage any of this with ddev config --disable-settings-management. That's the normal way to do things when DDEV's simplistic settings management is inadequate to the situation. I think any more complex project will usually end up with settings management disabled, because it's intended to get people going quickly with the simple situation.

@timkelty
Copy link
Contributor Author

timkelty commented Jan 1, 2024

I'm sure you know that you can tell DDEV not to manage any of this with ddev config --disable-settings-management. That's the normal way to do things when DDEV's simplistic settings management is inadequate to the situation. I think any more complex project will usually end up with settings management disabled, because it's intended to get people going quickly with the simple situation.

Yep. In this case, it isn't really about project complexity, and I think adding CRAFT_WEB_URL was just a mistake. It isn't a requirement to get Craft running, and users have all they need with just PRIMARY_SITE_URL. Pretty certain noone will mis it. I can work on a PR to remove it.

I do wish there was a .env.local in Craft CMS.

Craft, actually just consumes env vars, but doesn't require or use any kind of .env file directly. It is up to the project to load .env files in their bootstrap, so you can do this kind of .env.local yourself pretty easily.

@rfay
Copy link
Member

rfay commented Jan 2, 2024

(thanks for the info on .env.local idea, but

so you can do this kind of .env.local yourself pretty easily

doesn't much help DDEV to help people. Because the "you" is not DDEV right?

@timkelty
Copy link
Contributor Author

timkelty commented Jan 3, 2024

doesn't much help DDEV to help people. Because the "you" is not DDEV right?

Yep, was just clarifying why we don't currently support this natively within Craft. In the near future, Craft will be Laravel-based, which makes more formal use of dotenv as a dependency, so that will likely change then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants