I am new to Magento and I have noticed that everytime I run:
bin/magento setup:install --base-url=http://localhost:8090
--backend-frontname=admin
--db-host=magento_mysql
--db-name=webshop
--db-user=admin
--db-password=test1234
--admin-firstname=admin
--admin-lastname=admin
[email protected]
--admin-user=admin
--admin-password=test123
--language=nl_NL
--currency=EUR
--timezone=Europe/Amsterdam
--use-rewrites=1
--elasticsearch-host=elasticsearch
--elasticsearch-port=9200
The config.php
and env.php
file are being regenerated.
What I would like to accomplish is to have a default template with my custom configurations in those files and load in the database information and other sensisitive data from a .env
file. Using getenv("DB_PASS")
to retrieve the environment variables inside env.php.
The idea is that Magento will run inside Docker and when I deploy it to a server I don't want the install script to overwrite my local config files.
So is there a way to pre-configure Magento with custom env.php
and config.php
and make it use those files when setting everything up?
bin/magento setup:install
more than once? You can actually install your own config.php and env.php file prior to running setup:install. Keep in mind you probably shouldn't be running setup:install more than oncesetup:install
orsetup:upgrade
. If either file exists prior to running the install command, it will not be overwrittensetup:upgrade
, that looks promising. Will use that. I probably will not have to run it a lot. I realize that composer install generates a lot of files for allready. I can just push my env.php and config.php and then restore an initial database dump that can be shared among the team to make magento work out of the box without running setup:install