Skip to content

Commit e575c4b

Browse files
committed
Make kroki host configurable
1 parent 1db3f83 commit e575c4b

8 files changed

Lines changed: 31 additions & 5 deletions

File tree

.mocharc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"recursive": true
2+
"recursive": true,
3+
"file": "test/index.js"
34
}

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ Defaults to `yes`.
133133
> [`mermaid_renderer`](#mermaid_renderer) and [`plantuml_renderer`](#plantuml_renderer)
134134
> options below.
135135

136+
### `kroki_host`
137+
138+
*Optional*. When set this host is used as a kroki server instead of the default one.
139+
140+
Defaults to https://kroki.io
141+
136142
### `mermaid_renderer`
137143

138144
*Optional*. Can be one of:
@@ -188,7 +194,7 @@ jobs:
188194
- name: Checkout Source
189195
uses: actions/checkout@v3
190196
- name: Publish to Confluence
191-
uses: Workable/confluence-docs-as-code@v1
197+
uses: Workable/confluence-docs-as-code@v1.5.0
192198
with:
193199
confluence_tenant: 'Your Confluence Account Name'
194200
confluence_space: 'The Confluence Space Key'
@@ -199,6 +205,7 @@ jobs:
199205
confluence_force_update: ${{ github.event.inputs.confluence_force_update }} # Optional
200206
confluence_cleanup: ${{ github.event.inputs.confluence_cleanup }} # Optional
201207
kroki_enabled: 'no' # Optional
208+
kroki_host: 'https://kroki.io' # Optional
202209
mermaid_renderer: 'none' # Optional
203210
plantuml_renderer: 'none' # Optional
204211
```

action.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ inputs:
3737
description: 'When "yes" conversion of Mermaid & PlantUML graphs into images (png) using "kroki.io"'
3838
required: false
3939
default: 'yes'
40+
kroki_host:
41+
description: "Overwrite to use a local kroki deploymet"
42+
requierd: false
43+
default: 'https://kroki.io'
4044
mermaid_renderer:
4145
description: 'The strategy to use for mermaid graphs. Can be one of "none", "kroki" or "mermaid-plugin"'
4246
required: false

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const config = {
4343
}
4444
},
4545
kroki: {
46-
host: 'https://kroki.io'
46+
host: getInput('kroki_host')
4747
},
4848
plantuml: {
4949
baseUrl: 'https://www.plantuml.com/plantuml/img'

test/fixtures/.env.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ GITHUB_REF_NAME=branch-name
1010
GITHUB_SHA=git-hub-sha
1111
INPUT_MERMAID_RENDERER=
1212
INPUT_PLANTUML_RENDERER=
13+
INPUT_KROKI_HOST=https://kroki.io

test/lib/config.test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@ describe('config', () => {
2323
});
2424
});
2525
});
26+
27+
describe('when kroki has different host', () => {
28+
29+
beforeEach(() => {
30+
sandbox.replace(process.env, 'INPUT_KROKI_HOST', 'https://kroki.example.com');
31+
});
32+
33+
it('should get kroki host from action inputs', async () => {
34+
const config = await loadConfig();
35+
config.kroki.host.should.be.equal('https://kroki.example.com');
36+
});
37+
});
38+
2639
describe('when kroki is disabled', () => {
2740
beforeEach(() => {
2841
sandbox.replace(process.env, 'INPUT_KROKI_ENABLED', 'no');

0 commit comments

Comments
 (0)