Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ http:
showDetails: true
theme: hacker-terminal
refreshFrequency: 5s
readyOnStart: false
```

| Option | Type | Required | Default | Description |
Expand All @@ -93,6 +94,7 @@ http:
| `dynamic.showDetails` | boolean | No | Server default | Show detailed information on the waiting page |
| `dynamic.theme` | string | No | Server default | Theme for the waiting page (e.g., `hacker-terminal`, `ghost`, `matrix`) |
| `dynamic.refreshFrequency` | duration | No | Server default | How often the waiting page checks if instances are ready |
| `dynamic.readyOnStart` | boolean | No | `false` | Force `X-Sablier-Session-Status: ready` immediately regardless of instance health. No waiting page is shown. |
| `blocking.timeout` | duration | No | - | Maximum time to wait for instances to become ready |
| `ignoreUserAgent` | string or string\[\] | No | - | List of [Go regexp](https://pkg.go.dev/regexp/syntax) patterns. Requests whose `User-Agent` matches any pattern receive an immediate `HTTP 200` without waking the container. Can be specified as a YAML list (preferred) or as a single string (backward-compatible). Patterns are case-sensitive unless the `(?i)` flag is used. |

Expand Down
5 changes: 5 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type DynamicConfiguration struct {
ShowDetails *bool `yaml:"showDetails"`
Theme string `yaml:"theme"`
RefreshFrequency string `yaml:"refreshFrequency"`
ReadyOnStart *bool `yaml:"readyOnStart"`
}

type BlockingConfiguration struct {
Expand Down Expand Up @@ -165,6 +166,10 @@ func (c *Config) buildDynamicRequest(middlewareName string) (*http.Request, erro
q.Add("show_details", strconv.FormatBool(*c.Dynamic.ShowDetails))
}

if c.Dynamic.ReadyOnStart != nil {
q.Add("ready_on_start", strconv.FormatBool(*c.Dynamic.ReadyOnStart))
}

request.URL.RawQuery = q.Encode()

return request, nil
Expand Down
12 changes: 12 additions & 0 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,18 @@ func TestConfig_BuildRequest(t *testing.T) {
want: createRequest("GET", "http://sablier:10000/api/strategies/dynamic?display_name=sablier-middleware&names=nginx&names=apache&refresh_frequency=1m&session_duration=1m&show_details=false", nil),
wantErr: false,
},
{
name: "dynamic session with readyOnStart",
fields: fields{
SablierURL: "http://sablier:10000",
Names: "nginx",
Dynamic: &traefik.DynamicConfiguration{
ReadyOnStart: &tru,
},
},
want: createRequest("GET", "http://sablier:10000/api/strategies/dynamic?display_name=sablier-middleware&names=nginx&ready_on_start=true", nil),
wantErr: false,
},
{
name: "dynamic session without show details set",
fields: fields{
Expand Down