aaronpk / indielogin.com

Sign in with your domain name
https://indielogin.com
MIT License
155 stars 25 forks source link

12-factor QoL : ENV -> Config fallback #47

Closed Lewiscowles1986 closed 4 years ago

Lewiscowles1986 commented 5 years ago

Another PR from the Heroku button.

This one is modified to avoid the need for a redundant config file in environments which are more geared towards receiving configuration via environment such as Heroku, Docker, CloudFoundry.

Because of the absence of a test suite runner right now, I've included a PHP online sandbox. Because it blacklists the class_exists method I've omitted that ternary, and I also directly set $_ENV to simulate environment input (mutable state FTW I guess)

http://sandbox.onlinephpfunctions.com/code/5487577392110c118827c529d8f0e183b31b7d93

Both the Docker PR's #34 & #43 would benefit from these works

Lewiscowles1986 commented 4 years ago

Yeah looks like that regression was in one place. I just scanned through again

aaronpk commented 4 years ago

Thanks for this. I ended up rewriting this to use the dotenv library which is a little cleaner than supporting all these methods in the project itself. You can now define the config variables either in a .env file or as environment variables.