matrix-ipfs-bot

git clone git://archive.git.mtrnord.blog/MTRNord/matrix-ipfs-bot.git
Log | Files | Refs | LICENSE

config.rs (427B)


      1 use serde::{Deserialize, Serialize};
      2 use std::fs::OpenOptions;
      3 
      4 #[derive(Debug, PartialEq, Serialize, Deserialize)]
      5 pub struct Config {
      6     pub ipfs_gateway: String,
      7     pub ipfs_api: String,
      8 }
      9 
     10 impl Config {
     11     pub fn load() -> Self {
     12         let f = OpenOptions::new().read(true).open("./config.yml").unwrap();
     13         let json: Self = serde_yaml::from_reader(f).expect("config should be proper YAML");
     14         json
     15     }
     16 }