diff --git a/sample/sample.config.ron b/sample/sample.config.ron index 41a5539..e841f99 100644 --- a/sample/sample.config.ron +++ b/sample/sample.config.ron @@ -5,8 +5,9 @@ FriendlyConfig( use_tls: false, certchain_pem_path: "tls/fullchain.pem", key_pem_path: "tls/privkey.pem", - name: None, - description: None, + name: Some("Chorus Sample"), + description: Some("A sample run of the Chorus relay"), + contact: None, public_key_hex: None, user_hex_keys: [ "ee11a5dff40c19a555f41fe42b48f00e618c91225622ae37b6c2bb67b76c4e49" diff --git a/src/config.rs b/src/config.rs index ae4e420..5ca75f3 100644 --- a/src/config.rs +++ b/src/config.rs @@ -12,6 +12,7 @@ pub struct FriendlyConfig { pub key_pem_path: String, pub name: Option, pub description: Option, + pub contact: Option, pub public_key_hex: Option, pub user_hex_keys: Vec, pub verify_events: bool, @@ -29,6 +30,7 @@ impl Default for FriendlyConfig { key_pem_path: "./tls/privkey.pem".to_string(), name: None, description: None, + contact: None, public_key_hex: None, user_hex_keys: vec![], verify_events: true, @@ -48,6 +50,7 @@ impl FriendlyConfig { key_pem_path, name, description, + contact, public_key_hex, user_hex_keys, verify_events, @@ -73,6 +76,7 @@ impl FriendlyConfig { key_pem_path, name, description, + contact, public_key, user_keys, user_hex_keys, @@ -92,6 +96,7 @@ pub struct Config { pub key_pem_path: String, pub name: Option, pub description: Option, + pub contact: Option, pub public_key: Option, pub user_keys: Vec, pub user_hex_keys: Vec, diff --git a/src/web.rs b/src/web.rs index 049bf6a..ff17e24 100644 --- a/src/web.rs +++ b/src/web.rs @@ -59,6 +59,12 @@ fn build_rid(config: &Config) -> String { rid.push_str(description); rid.push('\"'); } + if let Some(contact) = &config.contact { + rid.push(','); + rid.push_str("\"contact\":\""); + rid.push_str(contact); + rid.push('\"'); + } if let Some(pubkey) = &config.public_key { let mut pkh: [u8; 64] = [0; 64]; pubkey.write_hex(&mut pkh).unwrap();