Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to get --config option to function (Kroki CLI) #39

Open
DaLynxx opened this issue Nov 10, 2024 · 1 comment
Open

Fails to get --config option to function (Kroki CLI) #39

DaLynxx opened this issue Nov 10, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@DaLynxx
Copy link

DaLynxx commented Nov 10, 2024

Hello,

I might be missing somthing when using Kroki cli.

I'm trying to get Kroki-CLI to work while using it's --config option. (Windows 11, Kroki CLI version 0.5.0)

Using the environment variables it works fine to re-direct to my own kroki renderingserver. However, if i try to get it via a .yml file it always goes to render at demo.kroki.io (Validating via Wireshark).

One test for "failure" is to have a) evn variable KROKI_ENDPOINT set to a server that does not have kroki installed (for example localhost) i then get the expected fail mesage:

fail to generate the image: Get "https://localhost:8000/seqdiag/svg/eNoqTi1MyUxMV6jm5VJQSCrKLy9OLVJQ0LVTKE9NKk4tKkstUojOSUxKzVGwVVBydw1R0M_MS0mt0Msoyc1RirVG1mWjq4vQZU2MeQH-wSEK-kk5-en6yfm5ual5JVAjEYpBWlMSSxKTEotTkXR6-gW7BoUo4NIFcgpMF1431vJyAQIAAP__hp9RJA==": dial tcp [::1]:8000: connectex: No connection could be made because the target machine actively refused it.

However, if I create a config.yml with

endpoint: 'http://localhost:8000'
timeout: '30s'

The kroki convert command (with --config config.yml) will happily generate me an svg using demo.kroki.io. It does not seem to be a "fallback to demo.kroki.io" because if the endpoint in the file is specified to the kroki server that I have locally it still directs the rendering to demo.kroki.io.

What am I doing wrong?

@ggrossetie
Copy link
Member

I think it's related to spf13/viper#1784.
Adding viper.SetConfigType("yaml") before reading the configuration file seems to fix this issue:

err = viper.ReadConfig(file)

Feel free to submit a pull request.

@ggrossetie ggrossetie added the bug Something isn't working label Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants