Sign inSign up

linksociety/curl-gotempl

By linksociety

•Updated over 4 years ago

cURL and gotempl image

Image
0

589

linksociety/curl-gotempl repository overview

⁠cURL GoTempl

This Docker image provides cURL⁠, gotempl⁠ and the script curl-gotempl to configure a cURL request with templated args (URL, body, headers, cookies, args and config are golang template files from gotempl).

⁠Environment

VariableDefaultDescription
REQUEST_URL-Required URL to work with
REQUEST_METHODGEThttp method to use
REQUEST_BODY``templated body to send such as request body. File if prefixed by @
REQUEST_HEADERS``templated http headers to send. File if prefixed by @
REQUEST_COOKIES``templated http cookies to send. File if prefixed by @
REQUEST_CONFIG``templated cURL config. File if prefixed by @
REQUEST_ARGS``cURL cli args
TEMPLATE_DATA``data to use in templates. File if prefixed by @
TEMPLATE_DATA_FORMATjsondata file format to use to complete request body, headers, cookies, args and configuration. Others are yaml and toml

⁠Example of Unit

---
apiVersion: kubirds.com/v1
kind: Unit
metadata:
  name: mywebsite-healthcheck
  namespace: default
  labels:
    mywebsite: healthcheck
spec:
  image:
    name: ghcr.io/link-society/curl-gotempl:latest
    pullPolicy: Always
    command: curl-gotempl
  env:
    - name: REQUEST_URL
      value: https://mywebsite.com/health

⁠Example of Reactor

---
apiVersion: kubirds.com/v1
kind: Reactor
metadata:
  name: http-notifier
  namespace: default
spec:
  unitSelector:
    mywebsite: healthcheck
  image:
    name: ghcr.io/link-society/curl-gotempl:latest
    pullPolicy: Always
    command: curl-gotempl
  env:
    - name: REQUEST_URL
      value: https://slack.api
    - name: TOKEN # authorization bearer token
      valueFrom:
        secretKeyRef:
          name: secret_name
          key: TOKEN
    - name: REQUEST_HEADERS # authorized request
      value: | # authorization and content-type
        Authorization: Bearer {{ .Env.TOKEN }}
        Content-Type: application/json
    - name: REQUEST_METHOD # POST method
      value: POST
    - name: REQUEST_ARGS # send unit logs through proxy
      value: | # proxy and unit output logs to upload
        -T {{ .Env.UNIT_OUTPUT }}
        -x https://myproxy:3000
    - name: REQUEST_BODY
      value: New state {{ .Env.UNIT_NAME }}/{{ .Env.UNIT_STATE }}

Tag summary

Content type

Image

Digest

Size

11.6 MB

Last updated

over 4 years ago

docker pull linksociety/curl-gotempl