DEV Community

Mohamed
Mohamed

Posted on

Laravel: Is it okay to change the config in runtime?!

I was working on implementing settings for emails, taxes, SMS providers so the client can change the credentials by themselves and switch between some providers.

That credentials and active providers are stored in the database, and I get 'em in the AppServiceProvider and overrider the config with 'em

But I had an issue with Queue Jobs

Since queue workers are long-lived processes, they will not notice changes to your code without being restarted

So I was in front of 2 solutions

  • Restart the worker after updating DB
  • Change how some integrated services like "Mail" get the config and replace 'em from database

I choose the 2nd solution since it's challenging πŸ™‚

But it okay to do so "Change the config in runtime"? I just dunno, maybe I'll have some issue like this in the future.

Top comments (0)