wip: rename harmony-secret* by harmony_secret*
All checks were successful
Run Check Script / check (pull_request) Successful in 1m14s

This commit is contained in:
Ian Letourneau 2025-08-28 14:29:24 -04:00
parent 8cc7adf196
commit f180cc4c80
8 changed files with 61 additions and 38 deletions

63
Cargo.lock generated
View File

@ -1716,8 +1716,11 @@ dependencies = [
"harmony", "harmony",
"harmony_cli", "harmony_cli",
"harmony_macros", "harmony_macros",
"harmony_secret",
"harmony_secret_derive",
"harmony_types", "harmony_types",
"log", "log",
"serde",
"tokio", "tokio",
"url", "url",
] ]
@ -2125,8 +2128,8 @@ dependencies = [
"env_logger", "env_logger",
"fqdn", "fqdn",
"futures-util", "futures-util",
"harmony-secret-derive",
"harmony_macros", "harmony_macros",
"harmony_secret_derive",
"harmony_types", "harmony_types",
"helm-wrapper-rs", "helm-wrapper-rs",
"hex", "hex",
@ -2166,35 +2169,6 @@ dependencies = [
"uuid", "uuid",
] ]
[[package]]
name = "harmony-secret"
version = "0.1.0"
dependencies = [
"async-trait",
"directories",
"harmony-secret-derive",
"http 1.3.1",
"infisical",
"lazy_static",
"log",
"pretty_assertions",
"serde",
"serde_json",
"tempfile",
"thiserror 2.0.14",
"tokio",
]
[[package]]
name = "harmony-secret-derive"
version = "0.1.0"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "harmony_cli" name = "harmony_cli"
version = "0.1.0" version = "0.1.0"
@ -2259,6 +2233,35 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "harmony_secret"
version = "0.1.0"
dependencies = [
"async-trait",
"directories",
"harmony_secret_derive",
"http 1.3.1",
"infisical",
"lazy_static",
"log",
"pretty_assertions",
"serde",
"serde_json",
"tempfile",
"thiserror 2.0.14",
"tokio",
]
[[package]]
name = "harmony_secret_derive"
version = "0.1.0"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "harmony_tui" name = "harmony_tui"
version = "0.1.0" version = "0.1.0"

View File

@ -10,6 +10,8 @@ publish = false
harmony = { path = "../../harmony" } harmony = { path = "../../harmony" }
harmony_cli = { path = "../../harmony_cli" } harmony_cli = { path = "../../harmony_cli" }
harmony_types = { path = "../../harmony_types" } harmony_types = { path = "../../harmony_types" }
harmony_secret = { path = "../../harmony_secret" }
harmony_secret_derive = { path = "../../harmony_secret_derive" }
cidr = { workspace = true } cidr = { workspace = true }
tokio = { workspace = true } tokio = { workspace = true }
harmony_macros = { path = "../../harmony_macros" } harmony_macros = { path = "../../harmony_macros" }
@ -17,3 +19,4 @@ log = { workspace = true }
env_logger = { workspace = true } env_logger = { workspace = true }
url = { workspace = true } url = { workspace = true }
askama = "0.14.0" askama = "0.14.0"
serde.workspace = true

View File

@ -22,7 +22,7 @@ async fn main() {
let cluster_pubkey_filename = "cluster_ssh_key.pub"; let cluster_pubkey_filename = "cluster_ssh_key.pub";
let harmony_inventory_agent = "harmony_inventory_agent"; let harmony_inventory_agent = "harmony_inventory_agent";
// TODO this should be a single IPXEScore instead of having the user do this step by step // TODO: this should be a single IPXEScore instead of having the user do this step by step
let scores: Vec<Box<dyn Score<HAClusterTopology>>> = vec![ let scores: Vec<Box<dyn Score<HAClusterTopology>>> = vec![
Box::new(DhcpScore { Box::new(DhcpScore {
host_binding: vec![], host_binding: vec![],

View File

@ -8,6 +8,14 @@ use harmony::{
topology::{HAClusterTopology, LogicalHost, UnmanagedRouter}, topology::{HAClusterTopology, LogicalHost, UnmanagedRouter},
}; };
use harmony_macros::{ip, ipv4}; use harmony_macros::{ip, ipv4};
use harmony_secret::{Secret, SecretManager};
use serde::{Deserialize, Serialize};
#[derive(Secret, Serialize, Deserialize, Debug, PartialEq)]
struct OPNSenseFirewallConfig {
username: String,
password: String,
}
pub async fn get_topology() -> HAClusterTopology { pub async fn get_topology() -> HAClusterTopology {
let firewall = harmony::topology::LogicalHost { let firewall = harmony::topology::LogicalHost {
@ -15,8 +23,17 @@ pub async fn get_topology() -> HAClusterTopology {
name: String::from("opnsense-1"), name: String::from("opnsense-1"),
}; };
let config = SecretManager::get::<OPNSenseFirewallConfig>().await;
let config = config.unwrap();
let opnsense = Arc::new( let opnsense = Arc::new(
harmony::infra::opnsense::OPNSenseFirewall::new(firewall, None, "root", "opnsense").await, harmony::infra::opnsense::OPNSenseFirewall::new(
firewall,
None,
&config.username,
&config.password,
)
.await,
); );
let lan_subnet = ipv4!("192.168.1.0"); let lan_subnet = ipv4!("192.168.1.0");
let gateway_ipv4 = ipv4!("192.168.1.1"); let gateway_ipv4 = ipv4!("192.168.1.1");

View File

@ -67,7 +67,7 @@ bollard.workspace = true
tar.workspace = true tar.workspace = true
base64.workspace = true base64.workspace = true
once_cell = "1.21.3" once_cell = "1.21.3"
harmony-secret-derive = { version = "0.1.0", path = "../harmony_secret_derive" } harmony_secret_derive = { version = "0.1.0", path = "../harmony_secret_derive" }
[dev-dependencies] [dev-dependencies]
pretty_assertions.workspace = true pretty_assertions.workspace = true

View File

@ -1,12 +1,12 @@
[package] [package]
name = "harmony-secret" name = "harmony_secret"
edition = "2024" edition = "2024"
version.workspace = true version.workspace = true
readme.workspace = true readme.workspace = true
license.workspace = true license.workspace = true
[dependencies] [dependencies]
harmony-secret-derive = { version = "0.1.0", path = "../harmony_secret_derive" } harmony_secret_derive = { version = "0.1.0", path = "../harmony_secret_derive" }
serde = { version = "1.0.209", features = ["derive", "rc"] } serde = { version = "1.0.209", features = ["derive", "rc"] }
serde_json = "1.0.127" serde_json = "1.0.127"
thiserror.workspace = true thiserror.workspace = true

View File

@ -1,5 +1,5 @@
[package] [package]
name = "harmony-secret-derive" name = "harmony_secret_derive"
version = "0.1.0" version = "0.1.0"
edition = "2024" edition = "2024"

View File

@ -10,10 +10,10 @@ pub fn derive_secret(input: TokenStream) -> TokenStream {
// The key for the secret will be the stringified name of the struct itself. // The key for the secret will be the stringified name of the struct itself.
// e.g., `struct OKDClusterSecret` becomes key `"OKDClusterSecret"`. // e.g., `struct OKDClusterSecret` becomes key `"OKDClusterSecret"`.
let key = struct_ident.to_string(); let key = struct_ident.to_string(); // TODO: Utiliser path complet de la struct
// Find the path to the `harmony_secret` crate. // Find the path to the `harmony_secret` crate.
let secret_crate_path = match crate_name("harmony-secret") { let secret_crate_path = match crate_name("harmony_secret") {
Ok(FoundCrate::Itself) => quote!(crate), Ok(FoundCrate::Itself) => quote!(crate),
Ok(FoundCrate::Name(name)) => { Ok(FoundCrate::Name(name)) => {
let ident = Ident::new(&name, proc_macro2::Span::call_site()); let ident = Ident::new(&name, proc_macro2::Span::call_site());