melcloud_api/api/types/
config.rs

1use std::env;
2
3// The Config struct is used to gather all of the configuration into one place.
4// At the moment, it is a combination of hard coding and environment variables.
5// I have not really planned ahead to thing where it is going to get the config from long term
6// but, lets learn to walk before we run ?
7#[derive(Debug)]
8pub struct Config {
9    pub api_url: String,
10    pub api_password: String,
11    pub api_username: String
12}
13
14impl Config {
15    pub fn new_with_creds(username: String, password: String) -> Config {
16        Config {
17            api_url: String::from("https://app.melcloud.com/Mitsubishi.Wifi.Client"),
18            api_username: username,
19            api_password: password
20        }
21    }
22    pub fn new(url: &str, username: &str, password: &str) -> Config {
23        Config {
24            api_url: String::from(url),
25            api_username: String::from(username),
26            api_password: String::from(password)
27        }
28
29    }
30}