-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Conversation
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 <[email protected]>
License: MIT Signed-off-by: Steven Allen <[email protected]>
if cfg.Identity.PrivKey == "" { | ||
return nil | ||
} | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 | ||
} | ||
|
There was a problem hiding this comment.
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
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