don't
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: add server-name to knot state

Server-name will be required when we start consuming records from the
firehose and authenticating inter-service auth requests.

Signed-off-by: tjh <did:plc:65gha4t3avpfpzmvpbwovss7>

+15 -4
+5 -1
crates/knot/src/cli.rs
··· 13 13 )] 14 14 pub addr: Vec<String>, 15 15 16 - /// DID or handle of the knot owner. 16 + /// FQDN of the knot server. 17 + #[arg(long, env = "KNOT_SERVER_NAME")] 18 + pub name: String, 19 + 20 + /// DID or handle of the knot server owner. 17 21 #[arg(long, env = "KNOT_SERVER_OWNER")] 18 22 pub owner: HandleOrDid, 19 23
+2 -2
crates/knot/src/main.rs
··· 58 58 59 59 pub async fn run(arguments: cli::Arguments) -> anyhow::Result<()> { 60 60 let resolver = Resolver::default(); 61 - let owner = arguments 61 + let resolved_owner = arguments 62 62 .owner 63 63 .into_did(&resolver) 64 64 .await ··· 117 117 tracing::info!(?latency, status = ?response.status()); 118 118 }), 119 119 ) 120 - .with_state(Knot::new(owner, arguments.repos)); 120 + .with_state(Knot::new(arguments.name, resolved_owner, arguments.repos)); 121 121 122 122 let mut sockets = Vec::with_capacity(arguments.addr.len()); 123 123 for addr in &arguments.addr {
+8 -1
crates/knot/src/model.rs
··· 55 55 } 56 56 57 57 struct KnotState { 58 + name: String, 58 59 owner: Did, 59 60 repository_base: PathBuf, 60 61 repository_cache: Mutex<FxHashMap<RepoSpec, ThreadSafeRepository>>, ··· 124 123 } 125 124 126 125 impl Knot { 127 - pub fn new(owner: Did, repository_base: impl AsRef<Path>) -> Self { 126 + pub fn new(name: String, owner: Did, repository_base: impl AsRef<Path>) -> Self { 128 127 let inner = Arc::new(KnotState { 128 + name, 129 129 owner, 130 130 repository_base: repository_base.as_ref().to_owned(), 131 131 repository_cache: Default::default(), 132 132 }); 133 133 134 134 Self { inner } 135 + } 136 + 137 + #[inline] 138 + pub fn name(&self) -> &str { 139 + &self.inner.name 135 140 } 136 141 137 142 #[inline]