feat(example/lamp): add LAMPScore and configuration support

- Introduce `LAMPScore` struct with additional fields: `domain`, `config`, and `php_version`.
- Define default implementation for `LAMPConfig`.
- Update `Url` enum to use `Url(url::Url)` instead of `Remote(url::Url)`.
- Adjust references in `HttpServer` and `TftpServer` implementations.
- Modify `Interpret` trait implementation to use `name()` method from `LAMPScore`.
This commit is contained in:
2025-03-10 17:04:35 -04:00
parent fbc18d2fad
commit 7291db7ca3
9 changed files with 104 additions and 6 deletions

18
examples/lamp/Cargo.toml Normal file
View File

@@ -0,0 +1,18 @@
[package]
name = "example-lamp"
edition = "2024"
version.workspace = true
readme.workspace = true
license.workspace = true
publish = false
[dependencies]
harmony = { path = "../../harmony" }
harmony_tui = { path = "../../harmony_tui" }
harmony_types = { path = "../../harmony_types" }
cidr = { workspace = true }
tokio = { workspace = true }
harmony_macros = { path = "../../harmony_macros" }
log = { workspace = true }
env_logger = { workspace = true }
url = { workspace = true }

View File

@@ -0,0 +1,3 @@
<?php
print_r("Hello this is from PHP")
?>

21
examples/lamp/src/main.rs Normal file
View File

@@ -0,0 +1,21 @@
use harmony::{
data::Version,
maestro::Maestro,
modules::lamp::{LAMPConfig, LAMPScore},
topology::Url,
};
#[tokio::main]
async fn main() {
let lamp_stack = LAMPScore {
name: "harmony-lamp-demo".to_string(),
domain: Url::Url(url::Url::parse("https://lampdemo.harmony.nationtech.io").unwrap()),
php_version: Version::from("8.4.4").unwrap(),
config: LAMPConfig {
project_root: "./php".into(),
..Default::default()
},
};
Maestro::load_from_env().interpret(Box::new(lamp_stack)).await.unwrap();
}