We have an app in Forge for which we want to use secrets (e.g. API tokens to an external API). Each secret is associated to a domain/installation.
I was thinking of using kvm and set secrets in there, so that the app can read them. But ideally we would like to create these secrets from the forge CLI (or a custom CLI) but there doesn’t seem to be a way to setSecret from outside a running forge app, and I don’t want to deploy an app with the secret.
I don’t want to use an environment variable because I will have a different secret per installation (or some global lookup where each “token” is associated with the installation’s domain).
Looking for suggestions / ideas on how to do this. I have a hunch that I may need to set up some convoluted workflow that has a remote listening for app installs that then uses the provided app token to create a secret via the API… (I have something similar to that for a different forge app, so I am familiar with the details but don’t think I need that level of automation ATM).
Ideally a “forge storage set-secret” would be perfect for me.
You are correct, KVS store data per installation. If the keys are unique per installation, then often apps have an Admin screen for the Customer Admin to update the required Secret and that is stored in KVS securely.
Related question then… when are environment variable changes picked up by the application? There are some cloud environments where one needs to (manually) redeploy or restart the app after an env var changes, else the app never loads the new value. How does Forge handle that?
Thanks Benny, but his doesn’t really answer my question, so let me rephrase.
In Atlassian Forge, when I add or update an environment variable, will all new invocations of my application automatically use the new value/variable? Or do I need to redeploy the application to ensure that is the case?
I know from experience (relearned several times ) that you have to manually redeploy. (That’s what Benny meant by “paired with the deployment process”.)