0

On DigitalOcean, I have an App and a Spaces Bucket with files.

I need my app to read and write on that bucket, therefore I need to provide it a Spaces Key and a Spaces Secret for my S3 Client.

However, I can't find any way to automatically provision those environment variables into a Digital Ocean App.

I tried to attach the Space to my app, but it is only possible with the databases. I also tried to use the Resources specific variables in the app env vars but nothing is suggested with the spaces.

maxime
  • 1,993
  • 3
  • 28
  • 57

1 Answers1

0

What about using:

APP_ID=<your_app_id>
SPACES_KEY=<your_spaces_key>
SPACES_SECRET=<your_spaces_secret>
ACCESS_TOKEN=<your_digitalocean_access_token>

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $ACCESS_TOKEN" \
     -d '{
       "variables": [
         {
           "key": "SPACES_KEY",
           "value": "'"$SPACES_KEY"'"
         },
         {
           "key": "SPACES_SECRET",
           "value": "'"$SPACES_SECRET"'"
         }
       ]
     }' \
     "https://api.digitalocean.com/v2/apps/$APP_ID/environment"

To automatically set those env vars?

Andrew Arrow
  • 4,248
  • 9
  • 53
  • 80
  • Sure I could manually generate them, store them as a secret and inject those values using my CI. But both services being from the same provider and designed to be used together - I was expecting a little bit more comfort by having them automatically generated and injected by any manner :) – maxime Jul 11 '23 at 03:07