Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the mapping for container env vars to aca-secrets #4

Merged
merged 1 commit into from
Nov 2, 2023

Conversation

vhvb1989
Copy link
Contributor

@vhvb1989 vhvb1989 commented Nov 2, 2023

As part of previous PR: #2

Infrastructure was updated from putting the OMDB_API_KEY and OPENAI_API_KEY directly in the env from the container-revision to, instead, putting this values within the AzureContainerApp secrets and creating an env-var within the revision which points to the aca-secret holding the value.

The change required a strategy to set upper-case, SNAKE_CASE env variables as aca-secrets because the aca-secrets has the same naming restrictions as a KeyVault secret. So, it is not possible to set a secret with the name OPENAI_API_KEY as aca-secret. The implemented strategy runs lowerCase() function and replaces _ for -.

The change was done correctly, but ended up breaking the python application because the application is expecting to find OMDB_API_KEY and OPENAI_API_KEY in env, but the changes from the infrastructure updated the name of this env vars as openaiApiKey and omdbApiKey, here: https://github.com/savannahostrowski/cinest/pull/2/files#diff-834bc11e3cb55730076a7d70767b75f794dc9a37305f27d99926e0fd24363c13R27

The change on this PR restores the name for the ENV VARS are it is expected by the python application.

The strategy mentioned before is still applied based on the new names, creating env vars for the container like:

{
      name: 'OMDB_API_KEY'
      secretRef: 'omdb-api-key'
},
{
      name: 'OPENAI_API_KEY'
      secretRef: 'openai-api-key'
},

and then, setting aca-secrets as:

image

Allowing the revision to pull the values from the aca-secrets.

@savannahostrowski savannahostrowski merged commit c082f05 into savannahostrowski:main Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants