mirror of
https://github.com/Cuprate/cuprate.git
synced 2024-12-23 03:59:31 +00:00
fix imports
This commit is contained in:
parent
26653d428d
commit
352dac694f
3 changed files with 7 additions and 7 deletions
|
@ -33,7 +33,7 @@ pub fn read_config_and_args() -> Config {
|
||||||
|
|
||||||
let config: Config = if let Some(config_file) = &args.config_file {
|
let config: Config = if let Some(config_file) = &args.config_file {
|
||||||
// If a config file was set in the args try to read it and exit if we can't.
|
// If a config file was set in the args try to read it and exit if we can't.
|
||||||
match Config::read_from_file(config_file) {
|
match Config::read_from_path(config_file) {
|
||||||
Ok(config) => config,
|
Ok(config) => config,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
tracing::error!("Failed to read config from file: {e}");
|
tracing::error!("Failed to read config from file: {e}");
|
||||||
|
@ -44,12 +44,12 @@ pub fn read_config_and_args() -> Config {
|
||||||
// First attempt to read the config file from the current directory.
|
// First attempt to read the config file from the current directory.
|
||||||
std::env::current_dir()
|
std::env::current_dir()
|
||||||
.map_err(Into::into)
|
.map_err(Into::into)
|
||||||
.and_then(Config::read_from_file)
|
.and_then(Config::read_from_path)
|
||||||
.inspect_err(|e| tracing::debug!("Failed to read config from current dir: {e}"))
|
.inspect_err(|e| tracing::debug!("Failed to read config from current dir: {e}"))
|
||||||
// otherwise try the main config directory.
|
// otherwise try the main config directory.
|
||||||
.or_else(|_| {
|
.or_else(|_| {
|
||||||
let file = CUPRATE_CONFIG_DIR.join(DEFAULT_CONFIG_FILE_NAME);
|
let file = CUPRATE_CONFIG_DIR.join(DEFAULT_CONFIG_FILE_NAME);
|
||||||
Config::read_from_file(file)
|
Config::read_from_path(file)
|
||||||
})
|
})
|
||||||
.inspect_err(|e| {
|
.inspect_err(|e| {
|
||||||
tracing::debug!("Failed to read config from config dir: {e}");
|
tracing::debug!("Failed to read config from config dir: {e}");
|
||||||
|
|
|
@ -4,7 +4,7 @@ use clap::builder::TypedValueParser;
|
||||||
|
|
||||||
use cuprate_helper::network::Network;
|
use cuprate_helper::network::Network;
|
||||||
|
|
||||||
use crate::config::{default::create_default_config_file, Config, DEFAULT_CONFIG_FILE_NAME};
|
use crate::config::{default::create_default_config_file, Config};
|
||||||
|
|
||||||
/// Cuprate Args.
|
/// Cuprate Args.
|
||||||
#[derive(clap::Parser, Debug)]
|
#[derive(clap::Parser, Debug)]
|
||||||
|
|
|
@ -4,9 +4,9 @@ use std::{
|
||||||
str::from_utf8,
|
str::from_utf8,
|
||||||
};
|
};
|
||||||
|
|
||||||
use cuprate_helper::fs::{CUPRATE_BLOCKCHAIN_DIR, CUPRATE_CACHE_DIR, CUPRATE_TXPOOL_DIR};
|
use cuprate_helper::fs::{
|
||||||
|
CUPRATE_BLOCKCHAIN_DIR, CUPRATE_CACHE_DIR, CUPRATE_TXPOOL_DIR, DEFAULT_CONFIG_FILE_NAME,
|
||||||
use crate::config::DEFAULT_CONFIG_FILE_NAME;
|
};
|
||||||
|
|
||||||
/// Creates a config file which will be named [`DEFAULT_CONFIG_FILE_NAME`] in the directory given in [`Path`].
|
/// Creates a config file which will be named [`DEFAULT_CONFIG_FILE_NAME`] in the directory given in [`Path`].
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in a new issue