Cronicle icon indicating copy to clipboard operation
Cronicle copied to clipboard

HTTP Plugin does not allow Variable Subsitution

Open arthurvanduynhoven opened this issue 3 years ago • 3 comments

Summary

When doing [/env/ENV_VAR] it is not replaced.

Steps to reproduce the problem

In URL, Headers, or Post data specify a substitution variable [/env/ENV_NODE]

Your Setup

Running inside Docker

Operating system and version?

Node LTS (Ubuntu)

Node.js version?

Latest LTS

Cronicle software version?

Latest

Are you using a multi-server setup, or just a single server?

both scenarios

Are you using the filesystem as back-end storage, or S3/Couchbase?

no

Can you reproduce the crash consistently?

yes

Log Excerpts

Other Notes:

I will create a MR for fix

arthurvanduynhoven avatar Mar 11 '21 15:03 arthurvanduynhoven

I guess it's a good idea to have env variable for that purpose. However the PR you propose will brig a braking change because you are removing job info. I believe there is already env variable carrier - job.env property. You can set it via config, from job_env key. I think the better approach for your ask is to merge job.env (if exist) with process.env.

mikeTWC1984 avatar Mar 12 '21 14:03 mikeTWC1984

I'm new to Cronicle - so spend too much time trying to get env vars working and started to debug the process itself.

So if merging the env context is better and will keep things backwards compatible then we can go that route. I'll close the existing MR.

arthurvanduynhoven avatar Mar 12 '21 14:03 arthurvanduynhoven

Whoever needs this functionality, you can add the line below in the begging of the callback on url-plugin.js:

job.env = Tools.mergeHashes(process.env, job.env);

mikeTWC1984 avatar Mar 16 '21 03:03 mikeTWC1984