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

Load AWS system environments #557

Closed
celsomtrindade opened this issue Jul 12, 2023 · 4 comments
Closed

Load AWS system environments #557

celsomtrindade opened this issue Jul 12, 2023 · 4 comments

Comments

@celsomtrindade
Copy link

celsomtrindade commented Jul 12, 2023

Is it possible to load AWS environment variables with this lib?

I used to use .env file, but on AWS they have these variables which seems to be best choice, specially because of my CI/CD worflow. Now I want to load from AWS Secrets Manager.

The way I was able to make it work, at least for now, was to disable the usage of this lib and directly use getenv().

Thanks

@GrahamCampbell
Copy link
Collaborator

I don't understand what your question is here?

@GrahamCampbell
Copy link
Collaborator

GrahamCampbell commented Nov 12, 2023

(FYI getenv is almost always the wrong choice, and will be broken if you are using php-fpm, for ~1-0.01% of requests, depending on server setup due to concurrency bugs - getenv is not threadsafe)

@frob
Copy link

frob commented Nov 13, 2023

I think the issue is that the aws sdk uses getenv to load the aws system credentials. The solution, I think is to load the credentials manually or, if your code is hosted on aws ec2, to use an ec2 role to provide access.

@GrahamCampbell
Copy link
Collaborator

You can request that we use getenv and putenv as per https://github.com/vlucas/phpdotenv?tab=readme-ov-file#putenv-and-getenv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants