dagu-org / dagu

Developer-friendly, minimalism Cron alternative, but with much more capabilities. It aims to solve greater problems.
https://dagu.readthedocs.io
GNU General Public License v3.0
1.66k stars 146 forks source link

Support Self-Signed Certs with http Executor #452

Open mnmercer opened 1 year ago

mnmercer commented 1 year ago

Currently there isn't a way to use the http executor if you need to make a request to a site with a self-signed cert. I can accomplish something similar by using curl and the -k flag like so:

- name: insecure http request
  command: sh
  script: |
    curl -k -s https://example.com/api/colors
  output: RESULT

But it would be great to use the http executor instead of this.

mnmercer commented 1 year ago

As a follow up to this, I cannot actually use the output of this type of curl request as an input to the jq executor. The actual request I am making returns formatted JSON, but if I have a step afterwards like this

  - name: unmarshal
    depends:
      - insecure http request
    executor:
      type: jq
        config:
          raw: true
    command: '.test'
    script: "$RESULT"
    output: TEST

I get an error from the jq executor that says Failed to start DAG: json: cannot unmarshal array into Go value of type map[string]interface {}.

bbqi commented 1 year ago

try:

curl -k -s "Content-Type: application/json" https://example.com/api/colors

mnmercer commented 1 year ago

@bbqi Apologies, I meant to say that I had included the -s flag in the curl call in the first step. Even with that though, the jq executor still throws the same error.