-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
44 lines (36 loc) · 1.41 KB
/
Copy pathbuild.rs
File metadata and controls
44 lines (36 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! A connector that fetches data from the HTS service and dumps it into `InfluxDB`.
fn main() {
use std::env;
#[cfg(not(debug_assertions))]
{
dotenv::dotenv().expect("Failed to load .env file");
}
let influxdb_url = env::var("INFLUXDB_URL");
let influxdb_bucket = env::var("INFLUXDB_BUCKET");
let influxdb_token = env::var("INFLUXDB_TOKEN");
let influxdb_org = env::var("INFLUXDB_ORG");
let text_file_path = env::var("TEXT_FILE_PATH");
#[cfg(not(debug_assertions))]
{
if influxdb_url.is_err() {
panic!("INFLUXDB_URL must be set");
}
if influxdb_bucket.is_err() {
panic!("INFLUXDB_BUCKET must be set");
}
if influxdb_token.is_err() {
panic!("INFLUXDB_TOKEN must be set");
}
if influxdb_org.is_err() {
panic!("INFLUXDB_ORG must be set");
}
if text_file_path.is_err() {
panic!("TEXT_FILE_PATH must be set");
}
}
println!("cargo:rustc-env=INFLUXDB_URL={}", influxdb_url.unwrap_or_default());
println!("cargo:rustc-env=INFLUXDB_BUCKET={}", influxdb_bucket.unwrap_or_default());
println!("cargo:rustc-env=INFLUXDB_TOKEN={}", influxdb_token.unwrap_or_default());
println!("cargo:rustc-env=INFLUXDB_ORG={}", influxdb_org.unwrap_or_default());
println!("cargo:rustc-env=TEXT_FILE_PATH={}", text_file_path.unwrap_or_default());
}