CodeIgniter Forums
Generating Database Configuration File - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Generating Database Configuration File (/showthread.php?tid=64841)



Generating Database Configuration File - egodoymachado - 03-31-2016

Hey guys,


I'm developing a web application like erp with crm's features, I would like to automate the process generating the config.php and database.config files, on my web application. I thought to create kind of a step-by-step installation like joomla installations. Have you some tip for do it?


RE: Generating Database Configuration File - josepostiga - 03-31-2016

Have you though about .env files? You can generate them relatively easy and load them with PHP getenv function.

Check this out: https://github.com/josepostiga/Codeigniter-env-support


RE: Generating Database Configuration File - egodoymachado - 04-01-2016

(03-31-2016, 01:20 PM)josepostiga Wrote: Have you though about .env files? You can generate them relatively easy and load them with PHP getenv function.

Check this out: https://github.com/josepostiga/Codeigniter-env-support

The problem isn't to identify the environment of application, the main problem how I should create a step-by-step installation (please enter with database server...,enter with your database user...., enter your database password..., please enter with your url of site...) then confirm this fields for example, the application will be put this information in files config.php and database.php.


RE: Generating Database Configuration File - josepostiga - 04-02-2016

The link I gave you is not to identify the environment of the application, but to load the configuration without being messing around with the config files directly. Also, you could create a system hook to check for that .env file existence and/or it's structure to know if you should redirect the request to a install controller.

That controller is the one who handles that installation process. You could create a method for each necessary step (app config, db config, etc).