forked from NationTech/harmony
wip: rename harmony-secret* by harmony_secret*
This commit is contained in:
parent
8cc7adf196
commit
f180cc4c80
63
Cargo.lock
generated
63
Cargo.lock
generated
@ -1716,8 +1716,11 @@ dependencies = [
|
||||
"harmony",
|
||||
"harmony_cli",
|
||||
"harmony_macros",
|
||||
"harmony_secret",
|
||||
"harmony_secret_derive",
|
||||
"harmony_types",
|
||||
"log",
|
||||
"serde",
|
||||
"tokio",
|
||||
"url",
|
||||
]
|
||||
@ -2125,8 +2128,8 @@ dependencies = [
|
||||
"env_logger",
|
||||
"fqdn",
|
||||
"futures-util",
|
||||
"harmony-secret-derive",
|
||||
"harmony_macros",
|
||||
"harmony_secret_derive",
|
||||
"harmony_types",
|
||||
"helm-wrapper-rs",
|
||||
"hex",
|
||||
@ -2166,35 +2169,6 @@ dependencies = [
|
||||
"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]]
|
||||
name = "harmony_cli"
|
||||
version = "0.1.0"
|
||||
@ -2259,6 +2233,35 @@ dependencies = [
|
||||
"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]]
|
||||
name = "harmony_tui"
|
||||
version = "0.1.0"
|
||||
|
@ -10,6 +10,8 @@ publish = false
|
||||
harmony = { path = "../../harmony" }
|
||||
harmony_cli = { path = "../../harmony_cli" }
|
||||
harmony_types = { path = "../../harmony_types" }
|
||||
harmony_secret = { path = "../../harmony_secret" }
|
||||
harmony_secret_derive = { path = "../../harmony_secret_derive" }
|
||||
cidr = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
harmony_macros = { path = "../../harmony_macros" }
|
||||
@ -17,3 +19,4 @@ log = { workspace = true }
|
||||
env_logger = { workspace = true }
|
||||
url = { workspace = true }
|
||||
askama = "0.14.0"
|
||||
serde.workspace = true
|
||||
|
@ -22,7 +22,7 @@ async fn main() {
|
||||
let cluster_pubkey_filename = "cluster_ssh_key.pub";
|
||||
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![
|
||||
Box::new(DhcpScore {
|
||||
host_binding: vec![],
|
||||
|
@ -8,6 +8,14 @@ use harmony::{
|
||||
topology::{HAClusterTopology, LogicalHost, UnmanagedRouter},
|
||||
};
|
||||
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 {
|
||||
let firewall = harmony::topology::LogicalHost {
|
||||
@ -15,8 +23,17 @@ pub async fn get_topology() -> HAClusterTopology {
|
||||
name: String::from("opnsense-1"),
|
||||
};
|
||||
|
||||
let config = SecretManager::get::<OPNSenseFirewallConfig>().await;
|
||||
let config = config.unwrap();
|
||||
|
||||
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 gateway_ipv4 = ipv4!("192.168.1.1");
|
||||
|
@ -67,7 +67,7 @@ bollard.workspace = true
|
||||
tar.workspace = true
|
||||
base64.workspace = true
|
||||
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]
|
||||
pretty_assertions.workspace = true
|
||||
|
@ -1,12 +1,12 @@
|
||||
[package]
|
||||
name = "harmony-secret"
|
||||
name = "harmony_secret"
|
||||
edition = "2024"
|
||||
version.workspace = true
|
||||
readme.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[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_json = "1.0.127"
|
||||
thiserror.workspace = true
|
||||
|
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "harmony-secret-derive"
|
||||
name = "harmony_secret_derive"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
|
@ -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.
|
||||
// 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.
|
||||
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::Name(name)) => {
|
||||
let ident = Ident::new(&name, proc_macro2::Span::call_site());
|
||||
|
Loading…
Reference in New Issue
Block a user