Added external URL
All checks were successful
Build Project / test (push) Successful in 5m53s

This commit is contained in:
2025-02-09 16:00:42 +00:00
parent 79d42c2760
commit 4fb7baf954
3 changed files with 7 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
actix-service = "2.0.2"
actix-web = "4.4.0"
chrono = { version = "0.4.31", features = ["serde"] }
dotenvy = "0.15"
@@ -20,4 +21,4 @@ tokio = { version = "1", features = ["fs", "rt-multi-thread"] }
[lints.clippy]
pedantic = "warn"
pedantic = "warn"

View File

@@ -1,5 +1,5 @@
# iot-cloud
## TODO
- Testing of values, displayName etc.
- Automated testing?
- Env var for fw dir
- basic auth for uploading

View File

@@ -26,6 +26,7 @@ async fn main() -> std::io::Result<()> {
process::exit(1);
}
};
let external_url = env::var("URL").unwrap_or("localhost".to_string());
info!("Connecting to Database {}", db_url);
let db = Database::init(&db_url).await;
@@ -36,7 +37,7 @@ async fn main() -> std::io::Result<()> {
.app_data(web::Data::new(AppState {
db: db.clone(),
firmwares_path: PathBuf::from("./fw"),
hostname: "0.0.0.0:8282".to_string(),
hostname: external_url.clone(),
}))
.app_data(web::PayloadConfig::new(256 * 1024 * 1024)) //256MB
.service(device_telemetry_api::receive_telemetry)
@@ -52,3 +53,4 @@ async fn main() -> std::io::Result<()> {
.run()
.await
}