Cleanup HTTP APIs, update ports to avoid gap, rustfmt
Moved the HTTP APIs away from the REST endpoint abstraction and to simpler Hyper handlers. Re-established all routes as v1. Changed wallet receiver port to 13415 to avoid a gap in port numbers. Finally, rustfmt seems to have ignored specific files arguments, running on everything.
This commit is contained in:
@@ -23,7 +23,7 @@ use toml;
|
||||
use grin::ServerConfig;
|
||||
use pow::types::MinerConfig;
|
||||
use util::LoggingConfig;
|
||||
use types::{ConfigMembers, GlobalConfig, ConfigError};
|
||||
use types::{ConfigError, ConfigMembers, GlobalConfig};
|
||||
|
||||
/// The default file name to use when trying to derive
|
||||
/// the config file location
|
||||
@@ -86,7 +86,6 @@ impl GlobalConfig {
|
||||
|
||||
// Give up
|
||||
Err(ConfigError::FileNotFoundError(String::from("")))
|
||||
|
||||
}
|
||||
|
||||
/// Takes the path to a config file, or if NONE, tries
|
||||
@@ -98,7 +97,7 @@ impl GlobalConfig {
|
||||
if let Some(fp) = file_path {
|
||||
return_value.config_file_path = Some(PathBuf::from(&fp));
|
||||
} else {
|
||||
let _result=return_value.derive_config_location();
|
||||
let _result = return_value.derive_config_location();
|
||||
}
|
||||
|
||||
// No attempt at a config file, just return defaults
|
||||
@@ -120,8 +119,8 @@ impl GlobalConfig {
|
||||
}
|
||||
|
||||
// Try to parse the config file if it exists
|
||||
// explode if it does exist but something's wrong
|
||||
// with it
|
||||
// explode if it does exist but something's wrong
|
||||
// with it
|
||||
return_value.read_config()
|
||||
}
|
||||
|
||||
@@ -134,7 +133,7 @@ impl GlobalConfig {
|
||||
match decoded {
|
||||
Ok(mut gc) => {
|
||||
// Put the struct back together, because the config
|
||||
// file was flattened a bit
|
||||
// file was flattened a bit
|
||||
gc.server.mining_config = gc.mining.clone();
|
||||
self.using_config_file = true;
|
||||
self.members = Some(gc);
|
||||
|
||||
+2
-2
@@ -28,11 +28,11 @@ extern crate toml;
|
||||
|
||||
extern crate grin_grin as grin;
|
||||
extern crate grin_p2p as p2p;
|
||||
extern crate grin_wallet as wallet;
|
||||
extern crate grin_pow as pow;
|
||||
extern crate grin_util as util;
|
||||
extern crate grin_wallet as wallet;
|
||||
|
||||
pub mod config;
|
||||
pub mod types;
|
||||
|
||||
pub use types::{GlobalConfig, ConfigMembers, ConfigError};
|
||||
pub use types::{ConfigError, ConfigMembers, GlobalConfig};
|
||||
|
||||
+7
-9
@@ -41,14 +41,12 @@ pub enum ConfigError {
|
||||
impl fmt::Display for ConfigError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
ConfigError::ParseError(ref file_name, ref message) => {
|
||||
write!(
|
||||
f,
|
||||
"Error parsing configuration file at {} - {}",
|
||||
file_name,
|
||||
message
|
||||
)
|
||||
}
|
||||
ConfigError::ParseError(ref file_name, ref message) => write!(
|
||||
f,
|
||||
"Error parsing configuration file at {} - {}",
|
||||
file_name,
|
||||
message
|
||||
),
|
||||
ConfigError::FileIOError(ref file_name, ref message) => {
|
||||
write!(f, "{} {}", message, file_name)
|
||||
}
|
||||
@@ -102,7 +100,7 @@ pub struct ConfigMembers {
|
||||
pub mining: Option<MinerConfig>,
|
||||
/// Logging config
|
||||
pub logging: Option<LoggingConfig>,
|
||||
|
||||
|
||||
//removing wallet from here for now,
|
||||
//as its concerns are separate from the server's, really
|
||||
//given it needs to manage keys. It should probably
|
||||
|
||||
Reference in New Issue
Block a user