Add SSHCA_CLI_DEBUG_TEST_MACHINE_ID env var
When running a debug build, the `sshca host sign` command will now check the `SSHCA_CLI_DEBUG_TEST_MACHINE_ID` environment variable for the value to use as the machine ID. This is useful during development and testing, where the real machine ID is inaccessible or otherwise unavailable. The `SSHCA_CLI_DEBUG_TEST_MACHINE_ID` environment variable is *NOT* used at all in release builds.dev/auto-reload
parent
041788e818
commit
1d0e558163
|
@ -180,6 +180,13 @@ fn get_hostname() -> Option<String> {
|
|||
}
|
||||
|
||||
fn get_machine_id() -> Option<Uuid> {
|
||||
#[cfg(debug_assertions)]
|
||||
if let Ok(v) = std::env::var("SSHCA_CLI_DEBUG_TEST_MACHINE_ID") {
|
||||
if let Ok(u) = Uuid::parse_str(&v) {
|
||||
return Some(u);
|
||||
}
|
||||
};
|
||||
|
||||
match std::fs::read_to_string(RPI_SERIAL_PATH) {
|
||||
Ok(s) => match Uuid::parse_str(&format!(
|
||||
"{:0>32}",
|
||||
|
|
Loading…
Reference in New Issue