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
--admin-email=info@sample.com
--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?