Skip to content

Commit

Permalink
add customized store path support
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyYe committed Sep 10, 2019
1 parent 5c9a6ba commit 42e27b8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ SKM is a simple and powerful SSH Keys Manager. It helps you to manage your multi
* Rename SSH key alias name
* Backup and restore all your SSH keys
* Prompt UI for SSH key selection
* Customized SSH key store path

## Installation

Expand Down Expand Up @@ -285,6 +286,15 @@ __List your cached SSH keys from SSH agent__
2048 SHA256:qAVcwc0tdUOCjH3sTskwxAmfMQiL2sKtfPBXFnUoZHQ /Users/timothy/.skm/my/id_rsa (RSA)
```

### Customized SSH key store path

By default, SKM uses `$HOME/.skm` as the default path of SSH key store.
You can define your customized in your `~/.bashrc` or `~/.zshrc` by adding:

```bash
SKM_STORE_PATH=/usr/local/.skm
```

### Hook mechanism

Edit and place a executable file named ```hook``` at the specified key directory, for example:
Expand Down
7 changes: 7 additions & 0 deletions cmd/skm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ import (
var defaultStorePath = filepath.Join(os.Getenv("HOME"), ".skm")
var defaultSSHPath = filepath.Join(os.Getenv("HOME"), ".ssh")

func init() {
// initialize the store path
if envStorePath := os.Getenv("SKM_STORE_PATH"); envStorePath != "" {
defaultStorePath = envStorePath
}
}

func main() {
parseArgs()

Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ require (
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/urfave/cli.v1 v1.20.0
)

go 1.13

0 comments on commit 42e27b8

Please sign in to comment.