diff --git a/internal/config/config_type.go b/internal/config/config_type.go index 9098a1c08..3714698bd 100644 --- a/internal/config/config_type.go +++ b/internal/config/config_type.go @@ -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: "", + }, }, }, }, diff --git a/internal/config/config_type_test.go b/internal/config/config_type_test.go index fca819f46..fe5e3f239 100644 --- a/internal/config/config_type_test.go +++ b/internal/config/config_type_test.go @@ -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) }