diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-03 10:45:50 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-03 10:45:50 +0200 |
| commit | 2de007f9ef8ae2724b9fbe2808ee25cbfe4ca876 (patch) | |
| tree | f91a742d682928ef12eb5a011411c3bb0ef16a02 /internal/config/client.go | |
| parent | 6d50a475114699911f2ebe1376915cd8317f1881 (diff) | |
feat(config): add auth-key CLI and server cache settings
Diffstat (limited to 'internal/config/client.go')
| -rw-r--r-- | internal/config/client.go | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/internal/config/client.go b/internal/config/client.go index 9f4df97..60c7bc5 100644 --- a/internal/config/client.go +++ b/internal/config/client.go @@ -1,6 +1,10 @@ package config -import "github.com/mimecast/dtail/internal/color" +import ( + "os" + + "github.com/mimecast/dtail/internal/color" +) type remoteTermColors struct { DelimiterAttr color.Attribute @@ -104,12 +108,16 @@ type termColors struct { type ClientConfig struct { TermColorsEnable bool `json:",omitempty"` TermColors termColors `json:",omitempty"` + AuthKeyPath string `json:",omitempty"` + AuthKeyDisable bool `json:",omitempty"` } // Create a new default client configuration. func newDefaultClientConfig() *ClientConfig { return &ClientConfig{ TermColorsEnable: true, + AuthKeyPath: defaultAuthKeyPath(), + AuthKeyDisable: false, TermColors: termColors{ Remote: remoteTermColors{ DelimiterAttr: color.AttrDim, @@ -198,3 +206,15 @@ func newDefaultClientConfig() *ClientConfig { }, } } + +func defaultAuthKeyPath() string { + homeDir, err := os.UserHomeDir() + if err != nil || homeDir == "" { + homeDir = os.Getenv("HOME") + } + if homeDir == "" { + return "~/.ssh/id_rsa" + } + + return homeDir + "/.ssh/id_rsa" +} |
