Skip to content

Commit 5f16256

Browse files
committed
Add config handling for http_unix_socket
1 parent fb54cae commit 5f16256

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

internal/config/config_type.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ var configOptions = []ConfigOption{
5050
Description: "the terminal pager program to send standard output to",
5151
DefaultValue: "",
5252
},
53+
{
54+
Key: "http_unix_socket",
55+
Description: "the path to a unix socket through which to make HTTP connection",
56+
DefaultValue: "",
57+
},
5358
}
5459

5560
func ConfigOptions() []ConfigOption {
@@ -179,6 +184,15 @@ func NewBlankRoot() *yaml.Node {
179184
},
180185
},
181186
},
187+
{
188+
HeadComment: "The path to a unix socket through which send HTTP connections. If blank, HTTP traffic will be handled by net/http.DefaultTransport.",
189+
Kind: yaml.ScalarNode,
190+
Value: "http_unix_socket",
191+
},
192+
{
193+
Kind: yaml.ScalarNode,
194+
Value: "",
195+
},
182196
},
183197
},
184198
},

internal/config/config_type_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ func Test_defaultConfig(t *testing.T) {
5050
# Aliases allow you to create nicknames for gh commands
5151
aliases:
5252
co: pr checkout
53+
# The path to a unix socket through which send HTTP connections. If blank, HTTP traffic will be handled by net/http.DefaultTransport.
54+
http_unix_socket:
5355
`)
5456
assert.Equal(t, expected, mainBuf.String())
5557
assert.Equal(t, "", hostsBuf.String())
@@ -81,6 +83,9 @@ func Test_ValidateValue(t *testing.T) {
8183

8284
err = ValidateValue("got", "123")
8385
assert.NoError(t, err)
86+
87+
err = ValidateValue("http_unix_socket", "really_anything/is/allowed/and/net.Dial\\(...\\)/will/ultimately/validate")
88+
assert.NoError(t, err)
8489
}
8590

8691
func Test_ValidateKey(t *testing.T) {
@@ -98,4 +103,7 @@ func Test_ValidateKey(t *testing.T) {
98103

99104
err = ValidateKey("pager")
100105
assert.NoError(t, err)
106+
107+
err = ValidateKey("http_unix_socket")
108+
assert.NoError(t, err)
101109
}

0 commit comments

Comments
 (0)