Basically I have a Laravel application which uses google/cloud-vision
package. Also using Laravel Vapor for deployment.
I'm trying to setup Github Actions. I'm using for google authentication. As per the document I added below lines to the deploy.yml
file
The documentation mentioned it exports environment variable GOOGLE_APPLICATION_CREDENTIALS
How can I make the env GOOGLE_APPLICATION_CREDENTIALS
available in Laravel application ?
I also tried below one but when I fetch env('GOOGLE_APPLICATION_CREDENTIALS')
it returns null.
Basically I have a Laravel application which uses google/cloud-vision
package. Also using Laravel Vapor for deployment.
I'm trying to setup Github Actions. I'm using https://github/google-github-actions/auth for google authentication. As per the document I added below lines to the deploy.yml
file
The documentation mentioned it exports environment variable GOOGLE_APPLICATION_CREDENTIALS
How can I make the env GOOGLE_APPLICATION_CREDENTIALS
available in Laravel application ?
I also tried below one but when I fetch env('GOOGLE_APPLICATION_CREDENTIALS')
it returns null.
1 Answer
Reset to default 0The google-github-actions/auth
action only exports GOOGLE_APPLICATION_CREDENTIALS
if create_credentials_file
is explicitly set to true
. Modify your deploy.yml
to include this:
- id: google-auth
name: Google Auth
uses: google-github-actions/auth@v2
with:
credentials_json: '${{ secrets.GOOGLE_API_CREDENTIALS }}'
create_credentials_file: true
env:
) is the way of sharing anyenv('xxxx')
onto any command you are running usingrun:
– matiaslauriti Commented Mar 14 at 16:52env('GOOGLE_APPLICATION_CREDENTIALS')
it returns null. So I believe the env variable is not setting. I also tried adding a simple env likeHELLO: 'WORLD'
and try to access in the application & it returns null. – Saumini Navaratnam Commented Mar 14 at 17:08php artisan optimize
orphp artisan config:cache
, thenenv
will always returnnull
anywhere, it must be done inside a config file for this to not happen, can you make sure to addenv('GOOGLE_APPLICATION_CREDENTIALS', 123)
so we just see if123
is there or what is going on? Where are you using theenv
? – matiaslauriti Commented Mar 14 at 18:08config:cache
explicitly, unless Laravel Vapor runs. Forenv('GOOGLE_APPLICATION_CREDENTIALS', 123)
it prints 123. I'm printing the env in the controller. What do you like to see more, thedeploy.yml
file or thevapor.yml
file ? – Saumini Navaratnam Commented Mar 17 at 21:50