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:
+18
-1
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user