parent
bba7fae8b9
commit
47e6cc59c0
7 changed files with 253 additions and 123 deletions
src/config
|
@ -1,4 +1,3 @@
|
|||
use std::{error::Error};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use crate::config::PostBody::Description;
|
||||
|
||||
|
@ -11,8 +10,11 @@ pub(crate) struct Config {
|
|||
}
|
||||
|
||||
impl Config {
|
||||
pub(crate) fn load() -> Result<Self, Box<dyn Error>> {
|
||||
let cfg: Self = confy::load_path("./config.toml")?;
|
||||
pub(crate) fn load() -> Result<Self, String> {
|
||||
let cfg: Self = match confy::load_path("./config.toml") {
|
||||
Ok(data) => data,
|
||||
Err(_) => panic!("config.toml not found!"),
|
||||
};
|
||||
if cfg.instance.is_empty() {
|
||||
panic!("config.toml not found!")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue