blackstork-io / fabric

An open-source command-line tool for reporting workflow automation and a configuration language for reusable templates. Reporting-as-Code
https://blackstork.io/fabric/
Apache License 2.0
12 stars 0 forks source link

Base URL as a required parameter in `elasticsearch` data source configuration #100

Closed traut closed 3 months ago

traut commented 3 months ago

Description

The base URL is not needed when cloud_id is set, so it should not be a required argument.

Steps to Reproduce

config data elasticsearch {
  cloud_id = "test-cloud-id"
  api_key = ["key-id", "key-value"]
  base_url = "https://localhost.localhost"
}

Expected Behavior

Actual Behavior

When base_url is not set:

$ ./fabric_darwin_arm64/fabric render document.test --plugins-dir ./plugins_darwin_arm64/plugins
Feb 18 14:21:58.214 WRN This is a dev version of the software
Feb 18 14:21:58.215 INF Loading plugin filename=plugins_darwin_arm64/plugins/blackstork/elasticsearch@v0.0.0-dev
Feb 18 14:21:58.227 ERR plugin process exited name=plugin.elasticsearch plugin=plugins_darwin_arm64/plugins/blackstork/elasticsearch@v0.0.0-dev id=40548 error="exit status 2"
Error: Missing required argument

  on 1.fabric line 7, in config "data" "elasticsearch":
   7: config data elasticsearch {

The argument "base_url" is required, but no definition was found.

Error: Failed to fetch data

rpc error: code = Unavailable desc = error reading from server: EOF

When both base_url and cloud_id are set:

$ ./fabric_darwin_arm64/fabric render document.test --plugins-dir ./plugins_darwin_arm64/plugins
Feb 18 14:22:12.032 WRN This is a dev version of the software
Feb 18 14:22:12.033 INF Loading plugin filename=plugins_darwin_arm64/plugins/blackstork/elasticsearch@v0.0.0-dev
Error: Failed to create elasticsearch client

cannot create client: both Addresses and CloudID are set

References