Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
Overriding Config files in runtime
skaterik
November 11
Hi,
I'm trying to override config files from in runtime.
Specifically I am trying to overwrite the email configuration.
What I do is the something like this:
Config::set('email.defaults.driver', $driver);
Config::set('email.defaults.from.email', $from_mail);
Config::set('email.defaults.from.name', $from_name);
But I don't see any effect, when using the email sending, the configuration of the file (email.php) is still being used.
Is there something I am not taking into consideration?
Thanks!
Harro
November 13
Accepted Answer
The Email package class loads its config when it is loaded for the first time. This will overwrite any config you've set before.
So the quick fix is to make sure it is loaded before you make changes. You can do that using
class_exists('Email', true);
which will trigger the class load and call its static constructor .
skaterik
November 14
Thanks, It works for me!
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
November 13
skaterik
November 14