-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* working config file * rustfmt * minors changes (logs, comments, fmt)
- Loading branch information
1 parent
4515110
commit d00d38d
Showing
9 changed files
with
115 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,6 @@ test/dist/* | |
|
||
# Ignore cSpell config files | ||
cSpell.json | ||
|
||
# Don't commit your config file | ||
config.toml |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[provider] | ||
provider_type = "bsp" # other choices are 'msp' and 'user' | ||
storage_layer = "memory" # other choice is 'rocksdb' | ||
max_storage_capacity = 4294967295 | ||
jump_capacity = 1073741824 | ||
extrinsic_retry_timeout = 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use log::error; | ||
use serde::Deserialize; | ||
use std::fs::File; | ||
use std::io::prelude::*; | ||
use std::path::Path; | ||
use toml; | ||
|
||
use crate::command::ProviderOptions; | ||
|
||
#[derive(Clone, Debug, Deserialize)] | ||
pub struct Config { | ||
pub provider: ProviderOptions, | ||
} | ||
|
||
pub fn read_config(path: &str) -> Option<Config> { | ||
let path = Path::new(path); | ||
|
||
if !path.exists() { | ||
error!("Fail to find config file ({:?})", path); | ||
|
||
return None; | ||
} | ||
|
||
let mut file = File::open(path).expect("config.toml file should exist"); | ||
let mut contents = String::new(); | ||
if let Err(err) = file.read_to_string(&mut contents) { | ||
error!("Fail to read config file : {}", err); | ||
|
||
return None; | ||
}; | ||
|
||
let config = match toml::from_str(&contents) { | ||
Err(err) => { | ||
error!("Fail to parse config file : {}", err); | ||
|
||
return None; | ||
} | ||
Ok(c) => c, | ||
}; | ||
|
||
return Some(config); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
mod chain_spec; | ||
mod cli; | ||
mod command; | ||
mod config; | ||
mod rpc; | ||
mod service; | ||
mod services; | ||
|