Question

plugin's environment management

  • 6 September 2023
  • 5 replies
  • 80 views

Badge +1

Hello

 

Let’s say I have a custom plugin in zapier, representing MyApp

MyApp has different environment, like Spain, French, Staging, and developpement. The only variability between the different env are the domain of some urls corresponding to MyApp’s webservices.

I thought of 2 different approaches to address that:

-having a unique app: The zapier user would specify at the account level which env is targetted. Downside I see: the plugin’s logs would be mixed up between environments.

-having  “several instances of plugin” with a template system. User would have to pick the plugin that match the target env. It would literally mean one plugin = one env, so I would have 3 plugins in that case. I would use the same source code but with a template to address variable domain url, and zapier push individual plugin each time I want to release  => would need a pipeline

 

Let me know what you think about it

Good day


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

5 replies

Badge +1

bump

Userlevel 3
Badge +6

Hi @wmarfil ,

This is a great question!

In cases like this, where the only major difference is the domain used by certain endpoints, we’d usually suggest the following:

  1. In your integration’s authentication configuration, add an input field where the user can select their environment
  2. Throughout the integration, reference the input field’s value to point requests to the right endpoints

For example, let’s say your auth’s input field had a key of my_env. The url of a given endpoint might look like:

http://{{bundle.authData.my_env}}.example.com/api/{endpoint}

This way, Zapier can dynamically fill in the url based on what the user selected initially. 

Badge +1

Hello @connorz 

 

That is a valid solution, but I only see one downside, related to logging:

Supposing we run an env of Dev, Staging, and Production…

this means `zapier logs` CLI command will not be able to separate logs between the three envs, because its in fact a single plugin for all envs.

 

Of course, I could prefix each log I decide to print for my code with the current env, but do I have control over every potential output logging done by the plugin ? There are some logs that are not handled by my node.js code, maybe ?

 

Instinctively, I am a bit hesitant mixing all envs like this.

 

Thank you

 

Badge +1

On top of that, in a case where Production is running with the plugin,

if I want to bring new development to the plugin without potentially breaking Production, I should absolutely have another plugin right ?

Badge +1

I read some more documentation and I think zap versioning does the job, but my question then is:

can I get log of a specific version ?