Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use BootstrapInterface instead of phpdotenv for global parameters #380

Closed
iadj opened this issue Mar 13, 2016 · 2 comments
Closed

Use BootstrapInterface instead of phpdotenv for global parameters #380

iadj opened this issue Mar 13, 2016 · 2 comments
Labels

Comments

@iadj
Copy link

iadj commented Mar 13, 2016

Suggested solution for the issue reported at #377

phpdotenv doesn't always work. Env variables sometimes return null on page load. Laravel has also stopped using phpdotenv variable loading for this particular reason. See issues:
vlucas/phpdotenv#109
vlucas/phpdotenv#76 (comment)

I think we should use Yii2's BootstrapInterface to load global variables. It's good to use as many 'vanilla' Yii2 features as possible to decrease dependencies on third party packages, and it will work 100% of the time rather than 90% of the time compared to phpdotenv.

See top answer for integration: http://stackoverflow.com/questions/27778477/how-to-make-custom-settings-data-available-globally-in-yii-2

@trntv
Copy link
Collaborator

trntv commented Mar 26, 2016

We can't use yii bootstrap process here, because it is invoked after config file has been loaded.
We need our settings inside config file, so they should be set before execution enters it.

@iadj
Copy link
Author

iadj commented Mar 26, 2016

@trntv Good point. Dotenv also appears to work properly when on a webserver. It only has issues locally. Is there some sort of fix we can implement i.e. setting a timeout or refresh period until dotenv is read?

@trntv trntv added the outdated label Apr 26, 2017
@trntv trntv closed this as completed Apr 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants