For the record, environment detection is fairly easy with EE 3:
https://gist.github.com/tjdraper/d875ecd2809ae52e4254
This is using the same principles as the Focus Lab master config, but trying to keep things as native as possible by using the EE user config file.
Yeah I like that TJ, it’s similar to what I use. This is partly an education issue, and partly providing a sensible default base.
One important security related issue for people using dynamic config, whether they use someone else’s solution or roll their own is to ensure that they either:
HTTP_HOST
headerNote on line 94 of config.php I’m requiring config.uploadPreferences.php
.
Then in config.uploadPreferences.php
I’m using the $uploadsPath
variable which I have set dynamically earlier in the config to get to the right directory for your public directory. From there you set your path. Make sure to use the DIRECTORY_SEPERATOR
constant if you want the config to work in any PHP/OS environment.
The URL can be set as a root-relative link as you see in the example.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.