format toml
This commit is contained in:
parent
a1a80276c9
commit
fbe4214918
5 changed files with 76 additions and 30 deletions
32
.taplo.toml
Normal file
32
.taplo.toml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
[formatting]
|
||||||
|
indent_string = "\t"
|
||||||
|
reorder_keys = false
|
||||||
|
reorder_arrays = false
|
||||||
|
reorder_inline_tables = true
|
||||||
|
|
||||||
|
[[rule]]
|
||||||
|
include = ["**/Cargo.toml"]
|
||||||
|
|
||||||
|
[rule.schema]
|
||||||
|
path = "https://json.schemastore.org/cargo.json"
|
||||||
|
enabled = true
|
||||||
|
|
||||||
|
# schema definition for .cargo/config.toml is not yet available
|
||||||
|
# see https://github.com/rust-lang/cargo/issues/12883
|
||||||
|
|
||||||
|
[[rule]]
|
||||||
|
include = ["**/Cargo.toml"]
|
||||||
|
keys = [
|
||||||
|
"build-dependencies",
|
||||||
|
"dependencies",
|
||||||
|
"dev-dependencies",
|
||||||
|
"target.*.build-dependencies",
|
||||||
|
"target.*.dependencies",
|
||||||
|
"target.*.dev-dependencies",
|
||||||
|
"workspace.dependencies",
|
||||||
|
"workspace.lints.clippy",
|
||||||
|
]
|
||||||
|
|
||||||
|
[rule.formatting]
|
||||||
|
reorder_keys = true
|
||||||
|
reorder_arrays = true
|
11
Cargo.toml
11
Cargo.toml
|
@ -8,11 +8,12 @@ version = "1.9.9-pre-9"
|
||||||
|
|
||||||
[workspace.lints.clippy]
|
[workspace.lints.clippy]
|
||||||
pedantic = "warn"
|
pedantic = "warn"
|
||||||
|
|
||||||
|
cast-possible-truncation = { level = "allow", priority = 1 }
|
||||||
|
cast-precision-loss = { level = "allow", priority = 1 }
|
||||||
|
default-trait-access = { level = "allow", priority = 1 }
|
||||||
|
missing-errors-doc = { level = "allow", priority = 1 }
|
||||||
|
missing-panics-doc = { level = "allow", priority = 1 }
|
||||||
module-name-repetitions = { level = "allow", priority = 1 }
|
module-name-repetitions = { level = "allow", priority = 1 }
|
||||||
struct-excessive-bools = { level = "allow", priority = 1 }
|
struct-excessive-bools = { level = "allow", priority = 1 }
|
||||||
too-many-lines = { level = "allow", priority = 1 }
|
too-many-lines = { level = "allow", priority = 1 }
|
||||||
default-trait-access = { level = "allow", priority = 1 }
|
|
||||||
cast-precision-loss = { level = "allow", priority = 1 }
|
|
||||||
cast-possible-truncation = { level = "allow", priority = 1 }
|
|
||||||
missing-errors-doc = { level = "allow", priority = 1 }
|
|
||||||
missing-panics-doc = { level = "allow", priority = 1 }
|
|
||||||
|
|
|
@ -12,20 +12,20 @@ systemd-units = { enable = false }
|
||||||
depends = ""
|
depends = ""
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
chrono = "0.4.39"
|
||||||
clap = { version = "4.5.23", features = ["derive"] }
|
clap = { version = "4.5.23", features = ["derive"] }
|
||||||
|
env_logger = "0.11.6"
|
||||||
|
eyre = "0.6.12"
|
||||||
|
futures = "0.3.31"
|
||||||
|
lazy_static = "1.5.0"
|
||||||
|
log = "0.4.22"
|
||||||
|
prometheus = "0.13.4"
|
||||||
|
rocket = { version = "0.5.1", features = ["json"] }
|
||||||
serde = { version = "1.0.216", features = ["derive"] }
|
serde = { version = "1.0.216", features = ["derive"] }
|
||||||
serde_json = "1.0.134"
|
serde_json = "1.0.134"
|
||||||
tokio = { version = "1.42.0", features = ["full"] }
|
tokio = { version = "1.42.0", features = ["full"] }
|
||||||
rocket = { version = "0.5.1", features = ["json"] }
|
|
||||||
chrono = "0.4.39"
|
|
||||||
prometheus = "0.13.4"
|
|
||||||
env_logger = "0.11.6"
|
|
||||||
log = "0.4.22"
|
|
||||||
futures = "0.3.31"
|
|
||||||
tokio-modbus = "0.16.1"
|
tokio-modbus = "0.16.1"
|
||||||
tokio-serial = "5.4.4"
|
tokio-serial = "5.4.4"
|
||||||
lazy_static = "1.5.0"
|
|
||||||
eyre = "0.6.12"
|
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|
|
@ -1,5 +1,18 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
static CONFIG_PATH: std::sync::OnceLock<std::path::PathBuf> = std::sync::OnceLock::new();
|
||||||
|
pub(super) static CONFIG: std::sync::OnceLock<tokio::sync::RwLock<Config>> =
|
||||||
|
std::sync::OnceLock::new();
|
||||||
|
|
||||||
|
pub async fn access_config<'a>() -> tokio::sync::RwLockReadGuard<'a, Config> {
|
||||||
|
CONFIG.get().unwrap().read().await
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) struct ConfigWatcher {
|
||||||
|
_debouncer: notify_debouncer_mini::Debouncer<notify_debouncer_mini::notify::RecommendedWatcher>,
|
||||||
|
_handle: tokio::task::JoinHandle<()>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Default)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Default)]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
|
|
|
@ -12,30 +12,30 @@ systemd-units = { enable = false }
|
||||||
depends = "charge-controller-supervisor"
|
depends = "charge-controller-supervisor"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
chrono = "0.4.39"
|
||||||
clap = { version = "4.5.23", features = ["derive"] }
|
clap = { version = "4.5.23", features = ["derive"] }
|
||||||
|
env_logger = "0.11.6"
|
||||||
|
eyre = "0.6.12"
|
||||||
|
if_chain = "1.0.2"
|
||||||
|
include_dir = "0.7.4"
|
||||||
|
lazy_static = "1.5.0"
|
||||||
|
log = "0.4.22"
|
||||||
|
notify-debouncer-mini = { version = "0.5.0", default-features = false }
|
||||||
|
prometheus = "0.13.4"
|
||||||
|
rand = "0.8.5"
|
||||||
|
reqwest = { version = "0.12.9", default-features = false, features = [
|
||||||
|
"json",
|
||||||
|
"rustls-tls",
|
||||||
|
] }
|
||||||
|
rocket = { version = "0.5.1", features = ["json"] }
|
||||||
ron = "0.8.1"
|
ron = "0.8.1"
|
||||||
serde = { version = "1.0.216", features = ["derive"] }
|
serde = { version = "1.0.216", features = ["derive"] }
|
||||||
serde_json = "1.0.134"
|
serde_json = "1.0.134"
|
||||||
tokio = { version = "1.42.0", features = ["full"] }
|
|
||||||
thiserror = "2.0.9"
|
|
||||||
rocket = { version = "0.5.1", features = ["json"] }
|
|
||||||
include_dir = "0.7.4"
|
|
||||||
chrono = "0.4.39"
|
|
||||||
prometheus = "0.13.4"
|
|
||||||
env_logger = "0.11.6"
|
|
||||||
log = "0.4.22"
|
|
||||||
serialport = "4.6.1"
|
serialport = "4.6.1"
|
||||||
|
thiserror = "2.0.9"
|
||||||
|
tokio = { version = "1.42.0", features = ["full"] }
|
||||||
tokio-modbus = "0.16.1"
|
tokio-modbus = "0.16.1"
|
||||||
tokio-serial = "5.4.4"
|
tokio-serial = "5.4.4"
|
||||||
if_chain = "1.0.2"
|
|
||||||
notify-debouncer-mini = { version = "0.5.0", default-features = false }
|
|
||||||
lazy_static = "1.5.0"
|
|
||||||
rand = "0.8.5"
|
|
||||||
reqwest = { version = "0.12.9", default-features = false, features = [
|
|
||||||
"rustls-tls",
|
|
||||||
"json",
|
|
||||||
] }
|
|
||||||
eyre = "0.6.12"
|
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|
Loading…
Add table
Reference in a new issue