php-perfect / ddev-intellij-plugin

DDEV Tool Integration for IntelliJ IDEA
https://plugins.jetbrains.com/plugin/18813-ddev-integration
BSD 3-Clause "New" or "Revised" License
110 stars 15 forks source link

Auto config breaks if project contains period `.` #367

Open IanEdington opened 2 months ago

IanEdington commented 2 months ago

Is there an existing issue for this?

Are you sure that this bug is related to this DDEV Integration Plugin?

Enter your error report ID (If available)

No response

Describe the bug

I have a project called gpo.ca (the URL of the site I'm working on) in ddev is fine with me calling it that and sanitizes the name where necessary.

I installed this plugin to use the ddev interpreter in phpstorm. The auto load was awesome but appears not to have done the same sanitization.

I was receiving an error Failed to start docker-compose service, start it in a command line and retry and found that the issue was with COMPOSE_PROJECT_NAME=ddev-secure.gpo.ca.

In the ./.ddev/.ddev-docker-compose-full.yaml file the project name is ddev-securegpoca

Changing COMPOSE_PROJECT_NAME to ddev-securegpoca fixed my issue.

Steps to reproduce

No response

Additional context

No response

rfay commented 2 months ago

docker-compose project names cannot contain a dot. DDEV removes the dot for compose project names. So COMPOSE_PROJECT_NAME must not have a dot and should be lower case.

This was all discussed in

for about 2 years. I guess maybe we have to look again @nico-loeber @AkibaAT ?

IanEdington commented 2 months ago

Thanks for the speedy reply! And nice to meet you.

My understanding is that the referenced issue is about removing the envvar. From what I've read on some IntelliJ tickets, it's still needed.

The fix for me was to change the value of the envvar not remove it. I'll try removing it though and see if that also works.

rfay commented 2 months ago

We decided that removing COMPOSE_PROJECT_NAME broke PhpStorm, because PhpStorm used it for an additional reason.

But I thought we had solved the "dot" problem elsewhere in PhpStorm.

bofalke commented 1 month ago

I took a look at this issue together with @edditor. The COMPOSE_PROJECT_NAME seems not to strip any dots or have any other sanitization. See the DockerComposeCredentialProviderImpl.java#L30. This seems not to cause any problems during the project setup, issues appear if you try to execute something inside the container via PHPStorm (e.g. PHPUnit).

I guess it should not be to much of a problem to update the COMPOSE_PROJECT_NAME to match the sanitization that is used by DDEV to generate the .ddev-docker-compose-full.yaml? DDEV seems to just strip the dots, check out the code here: ddevapp.go#L3209-L3210

AkibaAT commented 3 weeks ago

Here's a test build with added period removal: ddev-intellij-plugin-0.0.1-dev.zip

Closed my PR after realizing there already was one doing exactly the same thing right above.