Replies: 7 comments 3 replies
-
Dotenvy gets us part of the way there, anyway: https://github.com/nystudio107/dotenvy |
Beta Was this translation helpful? Give feedback.
-
Is this implemented in craft cms core, or should we still be using dotenvy? |
Beta Was this translation helpful? Give feedback.
-
It's not implemented in Craft core... but I think something like it would be nice to see. In terms of real-world performance, I'm not sure how much of a difference it will make for the lifecycle of a Craft request, though. |
Beta Was this translation helpful? Give feedback.
-
Good writeup on what |
Beta Was this translation helpful? Give feedback.
-
I'm not sure about the value here, because of this: Sure, this would help if you're using a .env file in production. But if you're doing that, you're already going down the wrong path, at least going by most dotenv guidelines. Generally, in production, you'd load this env using your infrastructure (e.g Docker, Sure, there may be some benefit to combining all the files from |
Beta Was this translation helpful? Give feedback.
-
I wish that were true, and agree it should be ideally how things are done -- but I think it's actually a rarity that it's actually done this way, from what I've seen anyway. I don't think solving this with "Craft Cloud" is a realistic way to consider the problem solved (though you can solve it there too, just like Matt has with Servd.host), because not everyone is going to use it. In any event, here's to hoping that a focus on performance is a priority as features are being added to Craft. |
Beta Was this translation helpful? Give feedback.
-
Quick note here: I'm in favor of this idea, but one roadblock at the moment is the circular dependency between the That said, I think Laravel's appoach actually writes a php file, not to cache, so maybe that isn't a concern. |
Beta Was this translation helpful? Give feedback.
-
Something analogous to to the Laravel
artisan config:cache
would be really useful for production deployment: https://laravel.com/docs/master/configuration#configuration-cachingIt could combine all of the
craft/config
files into one cached file for faster loading, and take all of the PHPdotenv settings and coalesce them into this cached config file so that it could be loaded quickly, without having to parse the.env
for every request.As per the PHPdotenv docs:
This is a perfect type of thing to be added as a Craft console command via
craft config/cache
or such. If the cache file exists, great, use it, and don't parse anything incraft/config
. If it doesn't exist, parse as normal.You'd essentially just be preflighting something that's the same for every request, and eliminating unnecessary overhead.
Beta Was this translation helpful? Give feedback.
All reactions