WordPress.org

Make WordPress Core

Opened 5 months ago

Last modified 5 months ago

#52668 new enhancement

Make it easier to override the built-in docker environment's config

Reported by: TimothyBlynJacobs Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: needs-patch
Focuses: Cc:

Description

Core currently ships with a .env file to provide a default configuration to the built-in Docker environment. If you want to override some of these variables you can setup values as environment variables before invoking the npm run env:* commands.

It can be a somewhat frustrating DUX if you need to consistently override these values, and not just once for testing some specific configuration. For instance if you need to use mariadb for ARM support, or making sure the correct port is used.

One possibility to make this more permanent is to modify the .env file itself, but then you need to remember to exclude changes to that file when committing which is a bit annoying.

There is the ability to create a docker-compose override file. But IMO that is a bit of overkill if just using the existing environment variable configuration would be sufficient.

One way I think we could solve this would be to change the .env file to .env.example and then in a post install routine copy the file from .env.example to .env if a .env file does not already exist. That way, if a user wants to they can customize that .env file without any fear that a future pull will overwrite their changes or that their changes would be accidentally included in a commit.

Change History (2)

#1 @johnbillion
5 months ago

  • Keywords needs-patch added
  • Version trunk deleted

#2 @afragen
5 months ago

Just to chime in. For Macs you can determine the chip architecture using uname -m.

Intel based Macs

$ uname -m
x86_64

M1 based Mac

$ uname -m
arm64

It might be useful in a setup script.

Note: See TracTickets for help on using tickets.