Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ inventory = { version = "0.3" }
itertools = { version = "^0.15" }
jsonschema = { version = "0.61", default-features = false }
json-patch = { version = "^5.0.0" }
lazy_static = { version = "^1.5" }
open = { version = "^5.4" }
openstack-cli-api = { path="cli/api", version = "0.13.8" }
openstack-cli-auth = { path="cli/auth", version = "0.13.8" }
Expand Down
1 change: 0 additions & 1 deletion openstack_tui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ eyre = { workspace = true }
futures = { workspace = true }
itertools = { workspace = true }
jsonschema = { workspace = true }
lazy_static = "^1.5"
open.workspace = true
openstack_sdk = { path = "../openstack_sdk", version = "^0.22", default-features = false, features = ["async", "block_storage", "compute", "dns", "identity", "image", "load_balancer", "network"] }
pretty_assertions = "^1.4"
Expand Down
29 changes: 15 additions & 14 deletions openstack_tui/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,30 @@
// SPDX-License-Identifier: Apache-2.0

use eyre::Result;
use lazy_static::lazy_static;
use ratatui::prelude::*;
use std::path::PathBuf;
use std::sync::LazyLock;
use tracing_error::ErrorLayer;
use tracing_subscriber::{
self, Layer, prelude::__tracing_subscriber_SubscriberExt, util::SubscriberInitExt,
};

const VERSION_MESSAGE: &str = concat!(env!("CARGO_PKG_VERSION"),);

lazy_static! {
pub static ref PROJECT_NAME: String = env!("CARGO_CRATE_NAME").to_uppercase().clone();
pub static ref DATA_FOLDER: Option<PathBuf> =
std::env::var(format!("{}_DATA", PROJECT_NAME.clone()))
.ok()
.map(PathBuf::from);
pub static ref CONFIG_FOLDER: Option<PathBuf> =
std::env::var(format!("{}_CONFIG", PROJECT_NAME.clone()))
.ok()
.map(PathBuf::from);
pub static ref LOG_ENV: String = format!("{}_LOGLEVEL", PROJECT_NAME.clone());
pub static ref LOG_FILE: String = format!("{}.log", env!("CARGO_PKG_NAME"));
}
pub static PROJECT_NAME: LazyLock<String> =
LazyLock::new(|| env!("CARGO_CRATE_NAME").to_uppercase());
pub static DATA_FOLDER: LazyLock<Option<PathBuf>> = LazyLock::new(|| {
std::env::var(format!("{}_DATA", *PROJECT_NAME))
.ok()
.map(PathBuf::from)
});
pub static CONFIG_FOLDER: LazyLock<Option<PathBuf>> = LazyLock::new(|| {
std::env::var(format!("{}_CONFIG", *PROJECT_NAME))
.ok()
.map(PathBuf::from)
});
pub static LOG_ENV: LazyLock<String> = LazyLock::new(|| format!("{}_LOGLEVEL", *PROJECT_NAME));
pub static LOG_FILE: LazyLock<String> = LazyLock::new(|| format!("{}.log", env!("CARGO_PKG_NAME")));

pub fn initialize_panic_handler() -> Result<()> {
let (panic_hook, eyre_hook) = color_eyre::config::HookBuilder::default()
Expand Down
Loading