Skip to content

Commit 2dc801e

Browse files
authored
surface idle timeout functionality (#3827)
* document idle timeout functionality * fix test
1 parent c0a1cf9 commit 2dc801e

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

internal/appconfig/definition_test.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ func TestToDefinition(t *testing.T) {
203203
"default_self_signed": false,
204204
},
205205
"http_options": map[string]any{
206-
"compress": true,
206+
"compress": true,
207+
"idle_timeout": int64(600),
207208
"response": map[string]any{
208209
"headers": map[string]any{
209210
"fly-request-id": false,
@@ -340,10 +341,13 @@ func TestToDefinition(t *testing.T) {
340341
},
341342
"ports": []any{
342343
map[string]any{
343-
"port": int64(80),
344-
"start_port": int64(100),
345-
"end_port": int64(200),
346-
"handlers": []any{"https"},
344+
"port": int64(80),
345+
"start_port": int64(100),
346+
"end_port": int64(200),
347+
"handlers": []any{"https"},
348+
"http_options": map[string]any{
349+
"idle_timeout": int64(600),
350+
},
347351
"force_https": true,
348352
},
349353
},

internal/appconfig/serde_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,8 @@ func TestLoadTOMLAppConfigReferenceFormat(t *testing.T) {
430430
DefaultSelfSigned: fly.Pointer(false),
431431
},
432432
HTTPOptions: &fly.HTTPOptions{
433-
Compress: fly.Pointer(true),
433+
Compress: fly.Pointer(true),
434+
IdleTimeout: UintPointer(600),
434435
Response: &fly.HTTPResponseOptions{
435436
Headers: map[string]any{
436437
"fly-request-id": false,
@@ -553,6 +554,9 @@ func TestLoadTOMLAppConfigReferenceFormat(t *testing.T) {
553554
EndPort: fly.Pointer(200),
554555
Handlers: []string{"https"},
555556
ForceHTTPS: true,
557+
HTTPOptions: &fly.HTTPOptions{
558+
IdleTimeout: UintPointer(600),
559+
},
556560
},
557561
},
558562

@@ -684,3 +688,7 @@ func TestYAMLPrettyPrint(t *testing.T) {
684688
assert.Contains(t, string(buf), "\n\nexperimental:\n cmd:\n - cmd\n")
685689
assert.Contains(t, string(buf), "\n processes:\n - web\n")
686690
}
691+
692+
func UintPointer(v uint32) *uint32 {
693+
return &v
694+
}

internal/appconfig/testdata/full-reference.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ host_dedication_id = "06031957"
9494
# https://community.fly.io/t/new-feature-basic-http-response-header-modification/3594
9595
[http_service.http_options]
9696
compress = true
97+
idle_timeout = 600
9798

9899
[http_service.http_options.response.headers]
99100
fly-request-id = false
@@ -189,6 +190,9 @@ host_dedication_id = "06031957"
189190
handlers = ["https"]
190191
force_https = true
191192

193+
[services.ports.http_options]
194+
idle_timeout = 600
195+
192196
[[services.tcp_checks]]
193197
interval = "21s"
194198
timeout = "4s"

0 commit comments

Comments
 (0)