This commit is contained in:
weisd
2024-11-26 11:19:16 +08:00
parent a5d8d1990c
commit f56a0d1b6d
3 changed files with 13 additions and 6 deletions
+7 -1
View File
@@ -13,7 +13,7 @@ use http::HeaderMap;
use lazy_static::lazy_static;
use s3s::dto::StreamingBlob;
use s3s::Body;
use tracing::error;
use tracing::{error, warn};
pub const CONFIG_PREFIX: &str = "config";
const CONFIG_FILE: &str = "config.json";
@@ -101,9 +101,12 @@ pub async fn read_config_without_migrate(api: &ECStore) -> Result<Config> {
Ok(res) => res,
Err(err) => {
if is_not_found(&err) {
warn!("config not found init start");
let cfg = new_and_save_server_config(api).await?;
warn!("config not found init done");
return Ok(cfg);
} else {
error!("read config err {:?}", &err);
return Err(err);
}
}
@@ -120,9 +123,12 @@ async fn read_server_config(api: &ECStore, data: &[u8]) -> Result<Config> {
Ok(res) => res,
Err(err) => {
if is_not_found(&err) {
warn!("config not found init start");
let cfg = new_and_save_server_config(api).await?;
warn!("config not found init done");
return Ok(cfg);
} else {
error!("read config err {:?}", &err);
return Err(err);
}
}
+6 -3
View File
@@ -24,7 +24,7 @@ use service::hybrid;
use std::{io::IsTerminal, net::SocketAddr, str::FromStr};
use tokio::net::TcpListener;
use tonic::{metadata::MetadataValue, Request, Status};
use tracing::{debug, info};
use tracing::{debug, error, info, warn};
use tracing_error::ErrorLayer;
use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt};
@@ -134,7 +134,6 @@ async fn run(opt: config::Opt) -> Result<()> {
};
let rpc_service = NodeServiceServer::with_interceptor(make_server(), check_auth);
info!(" init store success!");
tokio::spawn(async move {
let hyper_service = service.into_shared();
@@ -184,7 +183,11 @@ async fn run(opt: config::Opt) -> Result<()> {
.await
.map_err(|err| Error::from_string(err.to_string()))?;
store.init().await.map_err(|err| Error::from_string(err.to_string()))?;
store.init().await.map_err(|err| {
error!("init faild {:?}", &err);
Error::from_string(err.to_string())
})?;
warn!(" init store success!");
// init scanner
init_data_scanner().await;
-2
View File
@@ -15,7 +15,6 @@ use ecstore::bucket::policy_sys::PolicySys;
use ecstore::bucket::tagging::decode_tags;
use ecstore::bucket::tagging::encode_tags;
use ecstore::bucket::versioning_sys::BucketVersioningSys;
use ecstore::disk::error::DiskError;
use ecstore::new_object_layer_fn;
use ecstore::options::extract_metadata;
use ecstore::options::put_opts;
@@ -46,7 +45,6 @@ use s3s::S3;
use s3s::{S3Request, S3Response};
use std::fmt::Debug;
use std::str::FromStr;
use tracing::debug;
use tracing::error;
use tracing::info;
use transform_stream::AsyncTryStream;