By brackog
I have deployed Laravel app with passport authentication on DigitalOcean App Platform. The problem occur when the app gets deployed again and I need to generate new passport keys (php artisan passport:install). Is there a way to store those two files (oaut-private.key and oauth-public.key) as environment variables? I am new to this and I don’t really know how it works… Thanks for help!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
👋🏼 @brackog
Please let me know if I misunderstood your question, but I believe you can achieve this like so:
First, store the files’ contents in env vars and make sure to check the “Encrypt” box
PASSPORT_OAUTH_PRIVATE_KEY Value: contents of oauth-private.keyPASSPORT_OAUTH_PUBLIC_KEY Value: contents of oauth-public.keyThen, update your app’s run command to first write the files using the content from the env vars and then start Laravel:
echo -n "$PASSPORT_OAUTH_PRIVATE_KEY" >storage/oauth-private.key
echo -n "$PASSPORT_OAUTH_PUBLIC_KEY" >storage/oauth-public.key
heroku-php-apache2 public/
The -n flag stops echo from adding a newline at the end of the file in case that affects Laravel Passport.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.