Solved

How can I make it so that both the development and production API keys are added to the Ampli file on ampli pull?

  • 29 September 2022
  • 3 replies
  • 136 views

Badge

My organization has two projects: one development and production. They’re both tracking the same events and we’d like to be able to switch between the two projects as we’re using our application and changing environments. At first I manually added the development API key to the Ampli file, as there was a spot for it already above the production key, but whenever I use ampli pull in the terminal via the Ampli CLI to pull in the latest events, the Ampli file is regenerated and the development key I added is gone. How can I have both API keys pulled in and added to the Ampli file on ampli pull?

 

icon

Best answer by shreyas 3 October 2022, 21:22

View original

3 replies

Hi @michaelhandkins ,

 

Thanks for your question. We do not recommend modifying the generated code, while you are using the Ampli CLI + Ampli SDK.

 

To get this working, we recommend setting up environments in Amplitude-Data in the Environments tab. Once you have set this up, the appropriate API will be automatically included when you do:

ampli pull

 

Hopefully this works for you. 

Badge

@shreyas I do not have an Environments tab. Is this only available to those with Admin access?

@michaelhandkins : You might have to ask your admin to then set it up for you via:

Amplitude-Data → Settings page, as shown here:

 

Once configured for your project in Amplitude-Data, you should be able to switch the environment. 

Reply