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

startup: always load the private key #5844

Merged
merged 2 commits into from
Dec 13, 2018
Merged

startup: always load the private key #5844

merged 2 commits into from
Dec 13, 2018

Conversation

Stebalien
Copy link
Member

@Stebalien Stebalien commented Dec 13, 2018

Loading this at the last minute means we need a bunch of special cases in every command that needs routing, namesys, or even the public key.

If we ever have a case where we don't want to do this, we can add an option to the (eventual) IPFS constructor. Handling this up-front is going to be significantly less error prone.

Motivation: https://github.com/ipfs/go-ipfs/pull/5825/files#diff-fe35ea64d478c4f3fb767a3f618e5d01R863

Loading this at the last minute means we need a bunch of special cases
in *every* command that needs routing, namesys, or even the public key.

If we ever have a case where we don't want to do this, we can add an option to
the (eventual) IPFS constructor. Handling this up-front is going to be
significantly less error prone.

Motivation: https://github.com/ipfs/go-ipfs/pull/5825/files#diff-fe35ea64d478c4f3fb767a3f618e5d01R863

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
@ghost ghost assigned Stebalien Dec 13, 2018
@ghost ghost added the status/in-progress In progress label Dec 13, 2018
License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
if cfg.Identity.PrivKey == "" {
return nil
}

Copy link
Member Author

Choose a reason for hiding this comment

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

This means we can still start without the private key.

Copy link
Member

Choose a reason for hiding this comment

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

Might cause panics in some places, but that should only really affect tests

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe I've caught most places. Basically, everywhere we need the private key and would have otherwise called LoadPrivateKey or SetupOfflineRouting, we need to check if this is nil.

if cfg.Identity.PrivKey == "" {
return nil
}

Copy link
Member

Choose a reason for hiding this comment

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

Might cause panics in some places, but that should only really affect tests

@Stebalien Stebalien merged commit d0c2727 into master Dec 13, 2018
@ghost ghost removed the status/in-progress In progress label Dec 13, 2018
@Stebalien Stebalien deleted the feat/always-load-key branch December 14, 2018 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants