How to separate API keys?

Hello

I need to connect two apps to two DialogFlow agents seperately.

Do I have to create two RunKit accounts to do it?
Or how do I separate the API keys? Right now my API keys will affect all my endpoints.

Thank you.
Jonas

Hi Jonas,

There’s no need to create two RunKit accounts to do this. RunKit passes your environment variables to our evaluator context, so Node gets your environment variables as you would have in any other Node context: attached to process.env.

This means if a package you’re using requires its API key at a specific key in process.env (i.e. it must be called API_KEY or process.env.API_KEY), you can rename that process.env key before you invoke or require the package. In this sense, you’re only overwriting that environment variable in that Notebook (from that cell forward) and not in your global environment variables.

Example:

I first add two environment variables to my account at runkit.com/settings/environment:
49%20AM

Next, I can use the API key in it’s default form by evaluating process.env.API_KEY, and in the second cell, set that key to my secondary API_KEY like so:
44%20AM

This has the benefit of never needing to write secrets in the Notebook, while still being able to use the specific key on process.env that a package may expect.

Let me know if you have any other questions!