Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a config option to disable writing keyring to a file #472

Merged
merged 2 commits into from
Jun 14, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions serf/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ type Config struct {
// persist changes to the encryption keyring.
KeyringFile string

// DisableKeyringFile prevents serf from writing keyring data to the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use an empty KeyringFile name to indicate that this is disabled w/o a new config param?

// KeyringFile.
DisableKeyringFile bool

// Merge can be optionally provided to intercept a cluster merge
// and conditionally abort the merge.
Merge MergeDelegate
Expand Down
10 changes: 6 additions & 4 deletions serf/internal_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,12 @@ func (s *serfQueries) handleInstallKey(q *Query) {
goto SEND
}

if err := s.serf.writeKeyringFile(); err != nil {
response.Message = err.Error()
s.logger.Printf("[ERR] serf: Failed to write keyring file: %s", err)
goto SEND
if !s.serf.config.DisableKeyringFile {
if err := s.serf.writeKeyringFile(); err != nil {
response.Message = err.Error()
s.logger.Printf("[ERR] serf: Failed to write keyring file: %s", err)
goto SEND
}
}

response.Result = true
Expand Down