Finally switch over to Config instead of Settings

This commit is contained in:
Gregor Reitzenstein 2021-01-26 14:38:37 +00:00
parent 26f1de1907
commit 4c7359531d
6 changed files with 8 additions and 11 deletions

View File

@ -15,9 +15,6 @@ pub fn read(path: &Path) -> Result<Config> {
.map_err(Into::into) .map_err(Into::into)
} }
#[deprecated]
pub type Settings = Config;
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Config { pub struct Config {
/// A list of address/port pairs to listen on. /// A list of address/port pairs to listen on.

View File

@ -8,7 +8,7 @@ use flexbuffers;
use slog::Logger; use slog::Logger;
use lmdb::{Environment, Transaction, RwTransaction, Cursor}; use lmdb::{Environment, Transaction, RwTransaction, Cursor};
use crate::config::Settings; use crate::config::Config;
use crate::error::Result; use crate::error::Result;
use crate::db::access::{Permission, Role, RoleIdentifier, RoleDB}; use crate::db::access::{Permission, Role, RoleIdentifier, RoleDB};
@ -163,7 +163,7 @@ impl RoleDB for Internal {
/// Initialize the access db by loading all the lmdb databases /// Initialize the access db by loading all the lmdb databases
pub fn init(log: Logger, config: &Settings, env: Arc<lmdb::Environment>) pub fn init(log: Logger, config: &Config, env: Arc<lmdb::Environment>)
-> std::result::Result<Internal, crate::error::Error> -> std::result::Result<Internal, crate::error::Error>
{ {
let mut flags = lmdb::DatabaseFlags::empty(); let mut flags = lmdb::DatabaseFlags::empty();

View File

@ -5,7 +5,7 @@ use serde::{Serialize, Deserialize};
use std::sync::Arc; use std::sync::Arc;
use crate::error::Result; use crate::error::Result;
use crate::config::Settings; use crate::config::Config;
use uuid::Uuid; use uuid::Uuid;
@ -68,7 +68,7 @@ impl MachineState {
} }
} }
pub fn init(log: Logger, config: &Settings, env: Arc<lmdb::Environment>) -> Result<Internal> { pub fn init(log: Logger, config: &Config, env: Arc<lmdb::Environment>) -> Result<Internal> {
let mut flags = lmdb::DatabaseFlags::empty(); let mut flags = lmdb::DatabaseFlags::empty();
flags.set(lmdb::DatabaseFlags::INTEGER_KEY, true); flags.set(lmdb::DatabaseFlags::INTEGER_KEY, true);
let machdb = env.create_db(Some("machines"), flags)?; let machdb = env.create_db(Some("machines"), flags)?;

View File

@ -1,7 +1,7 @@
use std::sync::Arc; use std::sync::Arc;
use slog::Logger; use slog::Logger;
use lmdb::{Environment, Cursor, Transaction, RwTransaction}; use lmdb::{Environment, Transaction, RwTransaction};
use crate::error::Result; use crate::error::Result;

View File

@ -245,7 +245,7 @@ impl MachineDescription {
} }
} }
pub fn load(config: &crate::config::Settings, access: Arc<access::AccessControl>) pub fn load(config: &crate::config::Config, access: Arc<access::AccessControl>)
-> Result<MachineMap> -> Result<MachineMap>
{ {
let mut map = config.machines.clone(); let mut map = config.machines.clone();

View File

@ -1,7 +1,7 @@
use slog::Logger; use slog::Logger;
use crate::config; use crate::config;
use crate::config::Settings; use crate::config::Config;
use crate::error::Error; use crate::error::Error;
use crate::connection; use crate::connection;
@ -19,7 +19,7 @@ use crate::db::Databases;
use crate::network::Network; use crate::network::Network;
/// Handle all API connections and run the RPC tasks spawned from that on the local thread. /// Handle all API connections and run the RPC tasks spawned from that on the local thread.
pub fn serve_api_connections(log: Arc<Logger>, config: Settings, db: Databases, nw: Network) pub fn serve_api_connections(log: Arc<Logger>, config: Config, db: Databases, nw: Network)
-> Result<(), Error> -> Result<(), Error>
{ {
let signal = Box::pin(async { let signal = Box::pin(async {