algolia / firestore-algolia-search

Apache License 2.0
112 stars 35 forks source link

multi-environment configuration (secrets) #195

Closed austinn closed 7 months ago

austinn commented 8 months ago

I am trying to add this extension to multiple "environments" (projects) I have followed the recommendations for setting the .env and .secret.local file as referenced here

Algolia recommends creating separate API keys - so I created an API key for each "environment": (local*, dev*) I am using Secrets Manager to store these API keys. During the initial configuration I added my prod api key and it is stored here: projects/${param:PROJECT_NUMBER}/secrets/ext-firestore-algolia-search-ALGOLIA_API_KEY/versions/latest

I then updated my firestore-algolia-search.env.dev file to override the ALGOLIA_INDEX_NAME But the api key is still referencing the prod api key.

I tried creating a new API key (ext-firestore-algolia-search-dev-ALGOLIA_API_KEY) and overriding that in the .env.dev but when I went to deploy I got the following error:

Found 'projects/{PROJECT_NUMBER}/secrets/ext-firestore-algolia-search-dev-ALGOLIA_API_KEY/versions/latest' for secret param ALGOLIA_API_KEY, but this instance was previously using a different secret projects/{PROJECT_NUMBER}/secrets/ext-firestore-algolia-search-ALGOLIA_API_KEY

What is the best practice for store multiple API Keys in Secrets Manager?

smomin commented 8 months ago

You question might be better answered by the Google team responsible for the Secret Manager product.

smomin commented 7 months ago

Closing this issue since its not related to the extension.