Skip to content

Commit

Permalink
docs: update SideroLinkConfig example
Browse files Browse the repository at this point in the history
The provided example wasn't valid, it should not have a path component.

Signed-off-by: Andrey Smirnov <[email protected]>
  • Loading branch information
smira committed Jan 17, 2025
1 parent fc7080e commit 63157dc
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pkg/machinery/config/types/siderolink/siderolink.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type ConfigV1Alpha1 struct {
// SideroLink API URL to connect to.
// examples:
// - value: >
// "https://siderolink.api/join?token=secret"
// "https://siderolink.api/?jointoken=secret"
// schema:
// type: string
// pattern: "^(https|grpc)://"
Expand All @@ -76,7 +76,7 @@ func NewConfigV1Alpha1() *ConfigV1Alpha1 {

func exampleConfigV1Alpha1() *ConfigV1Alpha1 {
cfg := NewConfigV1Alpha1()
cfg.APIUrlConfig.URL = ensure.Value(url.Parse("https://siderolink.api/join?token=secret"))
cfg.APIUrlConfig.URL = ensure.Value(url.Parse("https://siderolink.api/jointoken?token=secret"))

return cfg
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/machinery/config/types/siderolink/siderolink_doc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions pkg/machinery/config/types/siderolink/siderolink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ func TestRedact(t *testing.T) {
t.Parallel()

cfg := siderolink.NewConfigV1Alpha1()
cfg.APIUrlConfig.URL = ensure.Value(url.Parse("https://siderolink.api/join?jointoken=secret&user=alice"))
cfg.APIUrlConfig.URL = ensure.Value(url.Parse("https://siderolink.api/?jointoken=secret&user=alice"))

assert.Equal(t, "https://siderolink.api/join?jointoken=secret&user=alice", cfg.SideroLink().APIUrl().String())
assert.Equal(t, "https://siderolink.api/?jointoken=secret&user=alice", cfg.SideroLink().APIUrl().String())

cfg.Redact("REDACTED")

assert.Equal(t, "https://siderolink.api/join?jointoken=REDACTED&user=alice", cfg.APIUrlConfig.String())
assert.Equal(t, "https://siderolink.api/?jointoken=REDACTED&user=alice", cfg.APIUrlConfig.String())
}

//go:embed testdata/document.yaml
Expand All @@ -37,7 +37,7 @@ func TestMarshalStability(t *testing.T) {
t.Parallel()

cfg := siderolink.NewConfigV1Alpha1()
cfg.APIUrlConfig.URL = ensure.Value(url.Parse("https://siderolink.api/join?jointoken=secret&user=alice"))
cfg.APIUrlConfig.URL = ensure.Value(url.Parse("https://siderolink.api/?jointoken=secret&user=alice"))

marshaled, err := encoder.NewEncoder(cfg, encoder.WithComments(encoder.CommentsDisabled)).Encode()
require.NoError(t, err)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
apiVersion: v1alpha1
kind: SideroLinkConfig
apiUrl: https://siderolink.api/join?jointoken=secret&user=alice
apiUrl: https://siderolink.api/?jointoken=secret&user=alice
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ title: SideroLinkConfig
{{< highlight yaml >}}
apiVersion: v1alpha1
kind: SideroLinkConfig
apiUrl: https://siderolink.api/join?token=secret # SideroLink API URL to connect to.
apiUrl: https://siderolink.api/jointoken?token=secret # SideroLink API URL to connect to.
{{< /highlight >}}


| Field | Type | Description | Value(s) |
|-------|------|-------------|----------|
|`apiUrl` |URL |SideroLink API URL to connect to. <details><summary>Show example(s)</summary>{{< highlight yaml >}}
apiUrl: https://siderolink.api/join?token=secret
apiUrl: https://siderolink.api/?jointoken=secret
{{< /highlight >}}</details> | |


Expand Down

0 comments on commit 63157dc

Please sign in to comment.