Skip to content

wp config create would benefit from clear path to defer all parameter initialization. #124

@JollyWizard

Description

@JollyWizard

It would seem to me that the optional/required parameters for wp config create are a little overbearing, especially considering the capabilities of wp config set. I don't see a strong reason why all of the parameters shouldn't be optional.

Verification is important, but given the wide variety of environments out there, the host/user only requirement seems very over/under in regards to actually having all the info to verify a connection (I'm assuming the purpose of them being required is to conduct that test).

Given the kitchen sink list of parameters possibly required, and the comparative ease of use of wp config set. It would be nice if there was an official, clearly indicated way to jump over to the for-each usage style.

I would prefer a flag that indicates this intention and skips the checks, but the command documentation could more clearly steer users to this possibility, as well.

I'm sure many users, like myself, are also interested in simplifying the injection of these parameters from the environment variables already present in their Docker container. At that point, you are already for-eaching in a bunch of (possibly missing) parameters, so why not include the other two.

To illustrate my process/point:


If setting up an environment like this:

$ docker run -it --rm wordpress:cli bash

bash-5.1$ wp core download --skip-content

Downloading WordPress 5.7 (en_US)...
md5 hash verified: b3033cdce55dd8c9af9eaed9233475d4
Success: WordPress downloaded.

This use case should have a shorthand flag, i.e. wp config create --template.

bash-5.1$ wp --skip-check config create --dbname= --dbuser=

Success: Generated 'wp-config.php' file.

To support setting all parameters in a for-each style like this (unrolled for clarity):

bash-5.1$ wp config set DB_NAME wordpress
Success: Updated the constant 'DB_NAME' in the 'wp-config.php' file with the value 'wordpress'.
bash-5.1$ wp config set DB_USER root
Success: Updated the constant 'DB_USER' in the 'wp-config.php' file with the value 'root'.
bash-5.1$ wp config set DB_PASSWORD example
Success: Updated the constant 'DB_PASSWORD' in the 'wp-config.php' file with the value 'example'.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions