diff --git a/Cargo.lock b/Cargo.lock index 5aa0d16..b7931de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -373,17 +373,6 @@ dependencies = [ "shlex", ] -[[package]] -name = "nginx-test" -version = "0.1.0" -dependencies = [ - "handlebars", - "ngx", - "rusqlite", - "serde", - "serde_json", -] - [[package]] name = "ngx" version = "0.5.0" @@ -624,6 +613,17 @@ version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +[[package]] +name = "sqlite-serve" +version = "0.1.0" +dependencies = [ + "handlebars", + "ngx", + "rusqlite", + "serde", + "serde_json", +] + [[package]] name = "strsim" version = "0.11.1" diff --git a/Cargo.toml b/Cargo.toml index 83f454a..e0e004f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "nginx-test" +name = "sqlite-serve" version = "0.1.0" edition = "2024" diff --git a/README.md b/README.md index 4fadcee..083736d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# nginx-test - SQLite Module for NGINX +# sqlite-serve - SQLite Module for NGINX A dynamic NGINX module written in Rust that integrates SQLite databases with Handlebars templating, enabling data-driven web applications directly from NGINX configuration. @@ -251,7 +251,7 @@ Request → NGINX → Module Handler → SQLite Query ## Project Structure ``` -nginx-test/ +sqlite-serve/ ├── src/ │ └── lib.rs # Module implementation ├── conf/ diff --git a/README_BOOK_CATALOG.md b/README_BOOK_CATALOG.md index 825be1b..12f1ff3 100644 --- a/README_BOOK_CATALOG.md +++ b/README_BOOK_CATALOG.md @@ -1,6 +1,6 @@ # Book Catalog Example -A complete example demonstrating the nginx-test SQLite module with a read-only book catalog. +A complete example demonstrating the sqlite-serve module with a read-only book catalog. ## Features @@ -54,7 +54,7 @@ Open your browser to: ## Directory Structure ``` -nginx-test/ +sqlite-serve/ ├── book_catalog.db # SQLite database ├── setup_book_catalog.sh # Database setup script ├── conf/ diff --git a/README_PARAMETERS.md b/README_PARAMETERS.md index 446fb04..406d803 100644 --- a/README_PARAMETERS.md +++ b/README_PARAMETERS.md @@ -1,6 +1,6 @@ # Path Parameters Feature -The nginx-test SQLite module supports parameterized SQL queries using nginx variables. This allows you to pass dynamic values from the request (query parameters, path captures, headers, etc.) as safe SQL prepared statement parameters. +The sqlite-serve module supports parameterized SQL queries using nginx variables. This allows you to pass dynamic values from the request (query parameters, path captures, headers, etc.) as safe SQL prepared statement parameters. ## New Directive diff --git a/conf/book_catalog.conf b/conf/book_catalog.conf index b142fc3..e4ea029 100644 --- a/conf/book_catalog.conf +++ b/conf/book_catalog.conf @@ -1,7 +1,7 @@ # Book Catalog Configuration -# Demonstrates the nginx-test SQLite module with multiple locations and template inheritance +# Demonstrates the sqlite-serve module with multiple locations and template inheritance -load_module target/debug/libnginx_test.dylib; +load_module target/debug/libsqlite_serve.dylib; worker_processes 1; events {} diff --git a/conf/book_detail.conf b/conf/book_detail.conf index 242c47a..dd124dd 100644 --- a/conf/book_detail.conf +++ b/conf/book_detail.conf @@ -1,7 +1,7 @@ # Book Detail Configuration # Demonstrates using path parameters with the SQLite module -load_module target/debug/libnginx_test.dylib; +load_module target/debug/libsqlite_serve.dylib; worker_processes 1; events {} diff --git a/conf/howto.conf b/conf/howto.conf index ac5b81d..bff105a 100644 --- a/conf/howto.conf +++ b/conf/howto.conf @@ -1,5 +1,5 @@ # Add the path to your library here. -load_module target/debug/libnginx_test.dylib; +load_module target/debug/libsqlite_serve.dylib; worker_processes 1; diff --git a/server_root/global_templates/footer.hbs b/server_root/global_templates/footer.hbs index 3a679b5..156cf94 100644 --- a/server_root/global_templates/footer.hbs +++ b/server_root/global_templates/footer.hbs @@ -1,6 +1,6 @@ diff --git a/src/lib.rs b/src/lib.rs index 8d27a1a..aaf7591 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -407,8 +407,6 @@ http_request_handler!(howto_access_handler, |request: &mut http::Request| { .unwrap_or(""); // Resolve query parameters from nginx variables - let _ = std::fs::write("/tmp/nginx_debug.txt", format!("Query: {}\nParams: {:?}\n", co.query, co.query_params)); - let mut param_values: Vec = Vec::new(); for var_name in &co.query_params { let value = if var_name.starts_with('$') { diff --git a/start_book_catalog.sh b/start_book_catalog.sh index 5b2ef2a..c54c490 100755 --- a/start_book_catalog.sh +++ b/start_book_catalog.sh @@ -14,7 +14,7 @@ if [ ! -f "book_catalog.db" ]; then fi # Check if module is built -if [ ! -f "target/debug/libnginx_test.dylib" ]; then +if [ ! -f "target/debug/libsqlite_serve.dylib" ]; then echo "Module not built. Building..." direnv exec "$PWD" cargo build echo "" diff --git a/start_book_detail.sh b/start_book_detail.sh index 913a2a2..f909f74 100755 --- a/start_book_detail.sh +++ b/start_book_detail.sh @@ -14,7 +14,7 @@ if [ ! -f "book_catalog.db" ]; then fi # Check if module is built -if [ ! -f "target/debug/libnginx_test.dylib" ]; then +if [ ! -f "target/debug/libsqlite_serve.dylib" ]; then echo "Module not built. Building..." direnv exec "$PWD" cargo build echo ""