Skip to content

Commit

Permalink
feat: remove dfdaemon.yaml in rpm and deb (#885)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi authored Dec 5, 2024
1 parent 31edec8 commit 6e25a2f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 231 deletions.
204 changes: 0 additions & 204 deletions ci/dfdaemon.yaml

This file was deleted.

3 changes: 1 addition & 2 deletions dragonfly-client-config/src/dfdaemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use tokio::fs;
use tonic::transport::{
Certificate as TonicCertificate, ClientTlsConfig, Identity, ServerTlsConfig,
};
use tracing::{error, info, instrument};
use tracing::{error, instrument};
use validator::Validate;

/// NAME is the name of dfdaemon.
Expand Down Expand Up @@ -1314,7 +1314,6 @@ impl Config {
// Load configuration from file.
let content = fs::read_to_string(path).await?;
let mut config: Config = serde_yaml::from_str(&content).or_err(ErrorType::ConfigError)?;
info!("load config from {}", path.display());

// Convert configuration.
config.convert();
Expand Down
24 changes: 0 additions & 24 deletions dragonfly-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,6 @@ assets = [
"lib/systemd/system/dfdaemon.service",
"644",
],
[
"../ci/dfdaemon.yaml",
"etc/dragonfly/dfdaemon.yaml",
"644",
],
[
"../CONTRIBUTING.md",
"usr/share/doc/client/CONTRIBUTING.md",
Expand Down Expand Up @@ -183,11 +178,6 @@ assets = [
"lib/systemd/system/dfdaemon.service",
"644",
],
[
"../ci/dfdaemon.yaml",
"etc/dragonfly/dfdaemon.yaml",
"644",
],
[
"../CONTRIBUTING.md",
"usr/share/doc/client/CONTRIBUTING.md",
Expand Down Expand Up @@ -235,11 +225,6 @@ assets = [
"lib/systemd/system/dfdaemon.service",
"644",
],
[
"../ci/dfdaemon.yaml",
"etc/dragonfly/dfdaemon.yaml",
"644",
],
[
"../CONTRIBUTING.md",
"usr/share/doc/client/CONTRIBUTING.md",
Expand Down Expand Up @@ -287,11 +272,6 @@ assets = [
"lib/systemd/system/dfdaemon.service",
"644",
],
[
"../ci/dfdaemon.yaml",
"etc/dragonfly/dfdaemon.yaml",
"644",
],
[
"../CONTRIBUTING.md",
"usr/share/doc/client/CONTRIBUTING.md",
Expand All @@ -316,7 +296,6 @@ assets = [
{ source = "../target/x86_64-unknown-linux-gnu/release/dfcache", dest = "/usr/bin/dfcache", mode = "755" },
{ source = "../target/x86_64-unknown-linux-gnu/release/dfstore", dest = "/usr/bin/dfstore", mode = "755" },
{ source = "../ci/dfdaemon.service", dest = "/lib/systemd/system/dfdaemon.service", config = true, mode = "644" },
{ source = "../ci/dfdaemon.yaml", dest = "/etc/dragonfly/dfdaemon.yaml", mode = "644", config = true },
{ source = "../CONTRIBUTING.md", dest = "/usr/share/doc/client/CONTRIBUTING.md", mode = "644", doc = true },
{ source = "../LICENSE", dest = "/usr/share/doc/client/LICENSE.md", mode = "644", doc = true },
{ source = "../README.md", dest = "/usr/share/doc/client/README.md", mode = "644", doc = true },
Expand All @@ -329,7 +308,6 @@ assets = [
{ source = "../target/x86_64-unknown-linux-musl/release/dfcache", dest = "/usr/bin/dfcache", mode = "755" },
{ source = "../target/x86_64-unknown-linux-musl/release/dfstore", dest = "/usr/bin/dfstore", mode = "755" },
{ source = "../ci/dfdaemon.service", dest = "/lib/systemd/system/dfdaemon.service", config = true, mode = "644" },
{ source = "../ci/dfdaemon.yaml", dest = "/etc/dragonfly/dfdaemon.yaml", mode = "644", config = true },
{ source = "../CONTRIBUTING.md", dest = "/usr/share/doc/client/CONTRIBUTING.md", mode = "644", doc = true },
{ source = "../LICENSE", dest = "/usr/share/doc/client/LICENSE.md", mode = "644", doc = true },
{ source = "../README.md", dest = "/usr/share/doc/client/README.md", mode = "644", doc = true },
Expand All @@ -343,7 +321,6 @@ assets = [
{ source = "../target/aarch64-unknown-linux-gnu/release/dfcache", dest = "/usr/bin/dfcache", mode = "755" },
{ source = "../target/aarch64-unknown-linux-gnu/release/dfstore", dest = "/usr/bin/dfstore", mode = "755" },
{ source = "../ci/dfdaemon.service", dest = "/lib/systemd/system/dfdaemon.service", config = true, mode = "644" },
{ source = "../ci/dfdaemon.yaml", dest = "/etc/dragonfly/dfdaemon.yaml", mode = "644", config = true },
{ source = "../CONTRIBUTING.md", dest = "/usr/share/doc/client/CONTRIBUTING.md", mode = "644", doc = true },
{ source = "../LICENSE", dest = "/usr/share/doc/client/LICENSE.md", mode = "644", doc = true },
{ source = "../README.md", dest = "/usr/share/doc/client/README.md", mode = "644", doc = true },
Expand All @@ -356,7 +333,6 @@ assets = [
{ source = "../target/aarch64-unknown-linux-musl/release/dfcache", dest = "/usr/bin/dfcache", mode = "755" },
{ source = "../target/aarch64-unknown-linux-musl/release/dfstore", dest = "/usr/bin/dfstore", mode = "755" },
{ source = "../ci/dfdaemon.service", dest = "/lib/systemd/system/dfdaemon.service", config = true, mode = "644" },
{ source = "../ci/dfdaemon.yaml", dest = "/etc/dragonfly/dfdaemon.yaml", mode = "644", config = true },
{ source = "../CONTRIBUTING.md", dest = "/usr/share/doc/client/CONTRIBUTING.md", mode = "644", doc = true },
{ source = "../LICENSE", dest = "/usr/share/doc/client/LICENSE.md", mode = "644", doc = true },
{ source = "../README.md", dest = "/usr/share/doc/client/README.md", mode = "644", doc = true },
Expand Down
28 changes: 27 additions & 1 deletion dragonfly-client/src/bin/dfdaemon/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use dragonfly_client_util::id_generator::IDGenerator;
use std::net::SocketAddr;
use std::path::PathBuf;
use std::sync::Arc;
use termion::{color, style};
use tokio::sync::mpsc;
use tokio::sync::Barrier;
use tracing::{error, info, Level};
Expand Down Expand Up @@ -115,7 +116,32 @@ async fn main() -> Result<(), anyhow::Error> {
let args = Args::parse();

// Load config.
let config = dfdaemon::Config::load(&args.config).await?;
let config = match dfdaemon::Config::load(&args.config).await {
Ok(config) => config,
Err(err) => {
eprintln!(
"{}{}Load config {} error: {}{}\n",
color::Fg(color::Red),
style::Bold,
args.config.display(),
err,
style::Reset
);

eprintln!(
"{}{}If the file does not exist, you need to new a default config file refer to: {}{}{}{}https://d7y.io/docs/next/reference/configuration/client/dfdaemon/{}",
color::Fg(color::Yellow),
style::Bold,
style::Reset,
color::Fg(color::Cyan),
style::Underline,
style::Italic,
style::Reset,
);
std::process::exit(1);
}
};

let config = Arc::new(config);

// Initialize tracing.
Expand Down

0 comments on commit 6e25a2f

Please sign in to comment.