diff --git a/binaries/cuprated/src/config/Cuprate.toml b/binaries/cuprated/src/config/Cuprate.toml index aa8031f8..0a92a178 100644 --- a/binaries/cuprated/src/config/Cuprate.toml +++ b/binaries/cuprated/src/config/Cuprate.toml @@ -36,7 +36,7 @@ max_white_list_length = 1_000 ## The size of the gray peer list, which contains peers we have not made a connection to before. max_gray_list_length = 5_000 ## The folder to store the address book. -peer_store_folder = "{cache}" +peer_store_folder = {cache} ## The amount of time between address book saves. peer_save_period = {{ secs = 90, nanos = 0 }} @@ -61,7 +61,7 @@ reader_threads = "OnePerThread" ## Txpool storage config. [storage.txpool] ## The txpool storage location. -path = "{txpool}" +path = {txpool} ## The database sync mode for the txpool. sync_mode = "Async" ## The maximum size of all the txs in the pool (bytes). @@ -70,6 +70,6 @@ max_txpool_size = 100_000_000 ## Blockchain storage config. [storage.blockchain] ## The blockchain storage location. -path = "{blockchain}" +path = {blockchain} ## The database sync mode for the blockchain. sync_mode = "Async" diff --git a/binaries/cuprated/src/config/default.rs b/binaries/cuprated/src/config/default.rs index 33d9b845..09022ca8 100644 --- a/binaries/cuprated/src/config/default.rs +++ b/binaries/cuprated/src/config/default.rs @@ -36,11 +36,19 @@ pub fn create_default_config_file(path: &Path) -> ! { /// Generates the text of the default config file. fn generate_config_text() -> String { + let toml_value_str = |t: &PathBuf| { + let mut value = String::new(); + + serde::Serialize::serialize(t, toml::ser::ValueSerializer::new(&mut value)).unwrap(); + + value + }; + format!( include_str!("Cuprate.toml"), - cache = CUPRATE_CACHE_DIR.to_string_lossy(), - txpool = CUPRATE_TXPOOL_DIR.to_string_lossy(), - blockchain = CUPRATE_BLOCKCHAIN_DIR.to_string_lossy() + cache = toml_value_str(&CUPRATE_CACHE_DIR), + txpool = toml_value_str(&CUPRATE_TXPOOL_DIR), + blockchain = toml_value_str(&CUPRATE_BLOCKCHAIN_DIR) ) } @@ -51,13 +59,6 @@ mod tests { #[test] fn generate_config_text_covers_all_values() { let text = generate_config_text(); - - #[cfg(target_os = "windows")] - { - let full_config = Config::default(); - panic!("{}", toml::to_string_pretty(&full_config).unwrap()); - } - let table: toml::Table = toml::from_str(&text).unwrap(); let full_config = Config::default();