diff --git a/system-images/compat/src/main.rs b/system-images/compat/src/main.rs index ea7a67b1b..9015b803c 100644 --- a/system-images/compat/src/main.rs +++ b/system-images/compat/src/main.rs @@ -1,4 +1,5 @@ use std::{ + env, fs::File, io::{stdin, stdout}, path::Path, @@ -19,6 +20,10 @@ use config::{ apply_dependency_configuration, validate_configuration, validate_dependency_configuration, }; use embassy::config::action::ConfigRes; +use serde_json::json; + +const PROPERTIES_FALLBACK_MESSAGE: &str = + "Could not find properties. The service might still be starting"; pub enum CompatRes { SetResult, ConfigRes, @@ -155,6 +160,10 @@ fn inner_main() -> Result<(), anyhow::Error> { Arg::with_name("mountpoint") .help("The data directory of the service to mount to.") .required(true), + ).arg( + Arg::with_name("fallbackMessage") + .help("The message to indicate that the startup is still working, or stats.yaml couldn't be found") + .required(false), ), ); let matches = app.get_matches(); @@ -295,7 +304,22 @@ fn inner_main() -> Result<(), anyhow::Error> { let stats: serde_json::Value = if stats_path.exists() { serde_yaml::from_reader(File::open(stats_path).unwrap()).unwrap() } else { - serde_json::Value::from("{}") + let fallbackMessage: &str = sub_m + .value_of("fallbackMessage") + .unwrap_or_else(|| PROPERTIES_FALLBACK_MESSAGE); + json!({ + "version": 2i64, + "data": { + "Not Ready": { + "type": "string", + "value": fallbackMessage, + "qr": false, + "copyable": false, + "masked": false, + "description":"Fallback Message When Properties could not be found" + } + } + }) }; serde_json::to_writer(stdout(), &stats)?; Ok(())