Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request : support the db config instead of .env while the core is initialzed #1618

Closed
TatwiraT opened this issue Dec 17, 2018 · 7 comments
Milestone

Comments

@TatwiraT
Copy link


name: Feature Request
about: It would be a great thing if, the core initializator take custom config instead those of env or app


Describe the bug
I used to use the db table settings as the main for the core initializator, to avoid editing Config/App.php every time i change the server or domain or any other extra-param that I need to use on runtime .

Usine a base controller is fine a bit, but the baseURL is not overwrite because the \CodeIgniter initializator take as params the Config\App before any initialization of other dependencies including DB instance.

CodeIgniter 4 version
All

Affected module(s)
CodeIgniter Initializator

Expected behavior, and steps to reproduce if appropriate
autoloading some custom db table configs to overwrite the app before any other dependencies that can be used globaly

Context

  • OS: Win/Linux
  • Apache/Nginx
  • PHP version : 7x
@lonnieezell
Copy link
Member

I'm confused on what exactly you're wanting to do. The .env file seems to solve what you're asking for. Could yo provide more concrete details?

@puschie286
Copy link
Contributor

puschie286 commented Dec 21, 2018

that would be an awesome feature 👍

His point is to use database stored configuration - like App.php variables loaded from database instead of local file
-> makes multiple configuration/installation much easier.

@TatwiraT
Copy link
Author

@puschie286 explained exactly what I want to say due to my bad English ^^
I used to put the settings,administrator, user ...etc object as a global variable which I can access every where using a helper, this feature is suportted but not avalaible untill the core is initialzed.
What I want is to use the my database settings instead of the file .env or App.php configs for the initializer of the CodeIgniter
the main problem is that the baseURL is not altered by my app settings stored in db, which urge me always to edit that file everytime i changed the domain or the machine.

@puschie286
Copy link
Contributor

puschie286 commented Jan 2, 2019

@TatwiraT
i know that problem^^ currently i use a install script, that configure CI for the target - but many costumers php installations doesn't have any write rights, so we need to ask the admin to change the stuff and configure our product :/ not to say this leaded to many problems, many admins can neither program nor script... so changing a variable is a bigger problem than you can imagine :D

@lonnieezell
Copy link
Member

That's something we can look into, and I can see it being handy to provide some other type of method for that. However, we're not doing any new features at the moment, so this will have to be looked at after 4.0 final for a 4.1 release.

@lonnieezell lonnieezell added this to the 4.1.0 milestone Jan 3, 2019
@TatwiraT
Copy link
Author

TatwiraT commented Feb 2, 2019

@puschie286 Yes, we drink from the same mug ^^
@lonnieezell thank you ^^

@lonnieezell
Copy link
Member

While I think this could be a nice feature, I am not convinced it needs to be part of the core. I've implemented something like this in the past for CI3 and it's fairly trivial to do. Seems like a good target for a third-party library. It's also something I've tossed around doing as a semi-official addon, but haven't had a chance just yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants