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

feat: allow custom kroki host #102

Merged
merged 2 commits into from
Aug 12, 2024
Merged

Conversation

l-zeuch
Copy link
Contributor

@l-zeuch l-zeuch commented Aug 4, 2024

Summary

Allow users to provide a custom Kroki URL instead of hard-coding
https://kroki.io.

Basic example

In params.toml, users of this theme can set a custom Kroki URL, such
as a local instance:

[doks]
    krokiURL = "http://localhost:8000"

I tried my best to keep proper backwards compatibility should users not
provide this configuration key at all—see the diff. Should this not be
acceptable, please let me know.

Motivation

At times, the upstream kroki.io service may run into resource exhaustion.
This can be due to a high volume of requests or a temporary outage.
During an automated build, this isn't so bad—caches should exist and
therefore not hit Kroki as often.

However, especially during the writing phase of
documentation, where fast iteration is often needed, it is not helpful
when the upstream service runs into said resource exhaustion and responds
with an unhelpful "Bad Request" error.

This issue is known and understood by the Kroki team; the fix is to run
your own instance.1


I will shortly raise a PR to gethyas/doks to reflect this change in the
configuration files.

Checks

  • Read Create a Pull Request
  • Supports all screen sizes (if relevant)
  • Supports both light and dark mode (if relevant)
  • Passes npm run test

Note: npm complains about not having a test script, therefore I could
not run it, hence unchecked.

Footnotes

  1. https://kroki.zulipchat.com/#narrow/stream/232085-users/topic/kroki.2Eio.20returns.20400.20on.20Mermaid.20diagrams

Copy link

changeset-bot bot commented Aug 4, 2024

🦋 Changeset detected

Latest commit: 7b402f9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hyas/doks-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@h-enk h-enk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks — nice one!

@h-enk h-enk merged commit 6a382d7 into thuliteio:main Aug 12, 2024
@l-zeuch l-zeuch deleted the custom-kroki-url branch August 12, 2024 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants