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:
18
examples/lamp/Cargo.toml
Normal file
18
examples/lamp/Cargo.toml
Normal 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 }
|
||||
3
examples/lamp/php/index.php
Normal file
3
examples/lamp/php/index.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
print_r("Hello this is from PHP")
|
||||
?>
|
||||
21
examples/lamp/src/main.rs
Normal file
21
examples/lamp/src/main.rs
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user