elk-rs 0.1.0

A Public SMTP Server to forward Messages into A Backend System
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Copyright 2022 Clivern. All rights reserved.
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.

pub fn get_config(key: &str, def: &str) -> String {
    match std::env::var(key) {
        Ok(val) => val,
        Err(_) => def.to_string(),
    }
}

#[test]
fn test_get_config() {
    assert_eq!(get_config("CARGO_PKG_NAME", ""), "elk");
    assert_eq!(get_config("CARGO__PKG_NAME", "default"), "default");
}