feat: add metadata-agregator gRPC client integration

- Add tonic/prost for gRPC client generation
- Add proto definitions from metadata-agregator service
- Add MetadataClient and MetadataService for gRPC communication
- Add REST controller exposing metadata endpoints (search, get, sync)
- Update config with metadata.endpoint setting
- Update flake.nix with protobuf for proto compilation
This commit is contained in:
Alexander
2026-04-28 18:58:31 +02:00
parent 1aaaab4640
commit 5afcbd68ad
15 changed files with 1250 additions and 21 deletions
+18 -1
View File
@@ -4,7 +4,7 @@ use tokio::sync::RwLock;
use axum::Router;
use music_agregator::{
api, config,
services::{IndexerService, TorrentService},
services::{IndexerService, MetadataService, TorrentService},
AppServices, AppState,
};
use tower_http::cors::{Any, CorsLayer};
@@ -60,9 +60,26 @@ async fn main() {
TorrentService::new()
};
let mut metadata_service = MetadataService::new(&config.metadata.endpoint);
match metadata_service.connect().await {
Ok(()) => {
tracing::info!(
"connected to metadata service at {}",
config.metadata.endpoint
);
}
Err(e) => {
tracing::warn!(
"failed to connect to metadata service: {} (continuing without metadata)",
e
);
}
}
let state: AppState = Arc::new(RwLock::new(AppServices::new(
indexer_service,
torrent_service,
metadata_service,
)));
let cors = CorsLayer::new()