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!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
👋🏼 @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.
Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
