any_type 0.5.0

A library for the Anytype API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use serde_json::{Value, from_str};

pub struct Config {
    pub server: String,
    pub api_key: String,
}
impl Config {
    pub fn get() -> Self {
        let config_json = std::fs::read_to_string("tests/tests_config.json").unwrap();
        let config: Value = from_str(&config_json).unwrap();
        let server: String = config["server"].as_str().unwrap().to_string();
        let api_key: String = config["api_key"].as_str().unwrap().to_string();
        Config { server, api_key }
    }
}