Skip to content

Running setup:config:set doesn't just update, but also deletes values, running it a second time fixes it (kind of) #2852

@hostep

Description

@hostep

Hi

When I run:

php bin/magento setup:config:set --db-user=username --db-password=password --db-name=new-database-name
Overwrite the existing configuration for db-name?[Y/n]Y
Overwrite the existing configuration for db-user?[Y/n]Y
Overwrite the existing configuration for db-password?[Y/n]Y
You saved the new configuration.

I would expect to see that the env.php file got updated with those 3 new values. And the file is updated correctly, but a bunch of other values have disappeared from the file:

  • db/table_prefix
  • db/connection/default/host
  • db/connection/default/model
  • db/connection/default/engine
  • db/connection/default/initStatement
  • db/connection/default/active

When running the exact same command again, just after the previous run, the missing values are back but we get some errors:

Overwrite the existing configuration for db-name?[Y/n]Y
Overwrite the existing configuration for db-user?[Y/n]Y
Overwrite the existing configuration for db-password?[Y/n]Y
We saved default values for these options: db-host, db-engine, db-prefix, db-model, db-init-statements.
We're sorry, an error occurred. Try clearing the cache and code generation directories. By default, they are: var/cache, var/di, var/generation, and var/page_cache.

  [InvalidArgumentException]
  MySQL adapter: Missing required configuration option 'host'

Looks like some kind of bug?

Might be related to #2623

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for development

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions