zDariN
zDariN

Reputation: 11

Setup .env file by CI4 controller

im new in CI4 i would like to create setup database by CI4 it is possible write db connection data to .env file by controller or some services CI4? Also want when complete setup change environment in .env that user cant access setup. If its not correct solution can some one tell how to do it best way?

im using CI 4.0.2

Upvotes: 0

Views: 2869

Answers (1)

Tsefo
Tsefo

Reputation: 409

In app/Config/Database.php you can set up multiple possible databases and from there you can depend them on specific environment.

By default you have 2 set up databases - default and tests. If env is set to tests it will load tests database settings, else will load default. You can expand it by adding more possible environments.

As in env file, there is section DATABASE, you can edit them there.

Upvotes: 1

Related Questions