diff options
| author | Fuwn <[email protected]> | 2021-04-27 17:02:09 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-04-27 17:02:09 +0000 |
| commit | fc5c05bce7a5f9d763d72b870717a530dfcf9524 (patch) | |
| tree | a9112c07c3cef656be38715cf143797529fbdbb2 /src/config.rs | |
| parent | etc: Add a Say Thanks button :) (diff) | |
| download | whirl-fc5c05bce7a5f9d763d72b870717a530dfcf9524.tar.xz whirl-fc5c05bce7a5f9d763d72b870717a530dfcf9524.zip | |
feature: New configuration file format
Diffstat (limited to 'src/config.rs')
| -rw-r--r-- | src/config.rs | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/src/config.rs b/src/config.rs deleted file mode 100644 index d1a49ce..0000000 --- a/src/config.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyleft 2021-2021 Whirlsplash -// SPDX-License-Identifier: GPL-3.0-only - -use serde_derive::{Deserialize, Serialize}; - -#[derive(Debug, Serialize, Deserialize)] -pub struct Config { - pub worldsmaster_greeting: String, - pub worldsmaster_username: String, - pub distributor_port: i32, - pub hub_port: i32, -} -impl Default for Config { - fn default() -> Self { - Config { - worldsmaster_greeting: "Welcome to Whirlsplash!".to_string(), - worldsmaster_username: "WORLDSMASTER".to_string(), - distributor_port: 6650, - hub_port: 5673, - } - } -} - -pub fn get_config() -> Result<Config, confy::ConfyError> { - let config: Config = confy::load_path("./.whirlrc.toml").unwrap(); - - Ok(config) -} - -pub fn store_config(config: Config) -> Result<(), confy::ConfyError> { - confy::store_path("./.whirlrc.toml", config) -} |