feat(core): load local and production configurations last#1266
feat(core): load local and production configurations last#1266innocenzi merged 2 commits intotempestphp:mainfrom
local and production configurations last#1266Conversation
|
I proposed environment-specific config files a long time ago (on Discord), but remember people not liking the idea. The question was asked: why not do it with env variables? Furthermore, because or config files are php files, you could have conditionals: if (get(Environment::class)->isLocal()) {
return new SQLiteConfig();
}
return new PostgresConfig();I'm not against per-file configs, but I also don't have a very strong opinion on the matter. |
|
Why not support both? People preferring conditionals in a single file can do this, and those preferring adding a That being said, Tempest should have a "recommendation" regarding the best way to handle this, because people are going to look for the idiomatic, Tempest way |
|
Ok two thoughts:
|
|
Yes, it loads all, so the last ones would override the previous ones. I'll update the PR for only loading And I totally agree with that recommendation 👍 |
|
Cool. Feel free to merge then when it's been changed :) Will you update the docs as well? |
|
Sure! |
This pull request changes the order of loaded config to put
.local.config.phpand.production.config.phplast, so they can override their "default" counterpart.This allows having different configurations in different environments. For instance, I may have a
storage.config.phpusing S3 by default, but astorage.local.config.phpusing a filesystem for local development.Related: #274