-
Notifications
You must be signed in to change notification settings - Fork 213
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
fix(derper): update config to auto generate keys #1599
Conversation
iroh-net/src/bin/derper.rs
Outdated
.await | ||
.context("unable to read config")?; | ||
let config = toml::from_str(&config_ser).context("unable to decode config")?; | ||
let mut secret_key_injected = false; | ||
if !config_ser.contains("secret_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.
I would strongly prefer to inject this after toml parsing, there is actually a nice way to do this.
#[serde(default = "SecretKey::generate")]
secret_key: SecretKey,
will do exactly that.
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 swear serde is more powerful than any AI we have so far :D
let config = toml::from_str(&config_ser).context("unable to decode config")?; | ||
let config: Self = toml::from_str(&config_ser).context("unable to decode config")?; | ||
if !config_ser.contains("secret_key") { | ||
config.write_to_file(path).await?; |
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.
one last complain, lets add a log line for this event
Description
Deploying a derper node is a bit cumbersome right now if you don't run with default config. You have to provide a
secret_key
but have no easy path to generate one so either you dance to create a fresh config and then modify it or need to use some external thing to generate keys for you. Either way it's cumbersome.This just adds an extra handler to inject a secret key if not present already in the supplied config.
Notes & open questions
Change checklist