ricoberger/script_exporter

env: expects list of strings, not a map.

gacerioni opened this issue · 1 comments

Howdy, Rico!

I have a sensitive pwd that I'd like to provide via env vars.

I tried to follow this snippet as an example:

scripts:
  - name: test_env
    command: /tmp/my_script.sh
    env:
      http_proxy: http://proxy.example.com:3128
      https_proxy: http://proxy.example.com:3128

But it throws this message:

script_exporter[2622]: ts=2023-07-03T22:48:51.713Z caller=exporter.go:57 level=error err="yaml: unmarshal errors:\n line 5: cannot unmarshal !!map into []string"

Version: v2.12.0

Long shoot:
And when I provide the env var as a list of str, it works:

scripts:
  - name: test_env
    command: /tmp/my_script.sh
    env:
    - http_proxy
    - https_proxy

Hi @gacerioni, thanks for pointing out. I missed this during the review of #65.

I will create a PR, so that it is implemented like in the examples.