Add config handling for http_unix_socket
This commit is contained in:
parent
fb54cae00e
commit
5f162561ac
2 changed files with 22 additions and 0 deletions
|
|
@ -50,6 +50,11 @@ var configOptions = []ConfigOption{
|
|||
Description: "the terminal pager program to send standard output to",
|
||||
DefaultValue: "",
|
||||
},
|
||||
{
|
||||
Key: "http_unix_socket",
|
||||
Description: "the path to a unix socket through which to make HTTP connection",
|
||||
DefaultValue: "",
|
||||
},
|
||||
}
|
||||
|
||||
func ConfigOptions() []ConfigOption {
|
||||
|
|
@ -179,6 +184,15 @@ func NewBlankRoot() *yaml.Node {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
HeadComment: "The path to a unix socket through which send HTTP connections. If blank, HTTP traffic will be handled by net/http.DefaultTransport.",
|
||||
Kind: yaml.ScalarNode,
|
||||
Value: "http_unix_socket",
|
||||
},
|
||||
{
|
||||
Kind: yaml.ScalarNode,
|
||||
Value: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ func Test_defaultConfig(t *testing.T) {
|
|||
# Aliases allow you to create nicknames for gh commands
|
||||
aliases:
|
||||
co: pr checkout
|
||||
# The path to a unix socket through which send HTTP connections. If blank, HTTP traffic will be handled by net/http.DefaultTransport.
|
||||
http_unix_socket:
|
||||
`)
|
||||
assert.Equal(t, expected, mainBuf.String())
|
||||
assert.Equal(t, "", hostsBuf.String())
|
||||
|
|
@ -81,6 +83,9 @@ func Test_ValidateValue(t *testing.T) {
|
|||
|
||||
err = ValidateValue("got", "123")
|
||||
assert.NoError(t, err)
|
||||
|
||||
err = ValidateValue("http_unix_socket", "really_anything/is/allowed/and/net.Dial\\(...\\)/will/ultimately/validate")
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func Test_ValidateKey(t *testing.T) {
|
||||
|
|
@ -98,4 +103,7 @@ func Test_ValidateKey(t *testing.T) {
|
|||
|
||||
err = ValidateKey("pager")
|
||||
assert.NoError(t, err)
|
||||
|
||||
err = ValidateKey("http_unix_socket")
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue