Add initial project structure with configuration, printing, and routing functionality

- Created a new Rust project with Cargo configuration.
- Added `.gitignore` to exclude target directory.
- Implemented `Cargo.lock` for dependency management.
- Defined application configuration in `config/app.yaml` and `src/config.rs`.
- Developed printing logic in `src/printer.rs` using `cups_rs` for printer interactions.
- Established routing and request handling in `src/routes.rs` for health checks and print requests.
- Introduced a scheduler in `src/scheduler.rs` to manage print job distribution.
- Created models for print parameters and job responses in `src/models.rs`.
- Set up the main application entry point in `src/main.rs` with server initialization and configuration loading.
- Included necessary dependencies in `Cargo.toml` for async handling, tracing, and configuration management.
This commit is contained in:
2025-12-11 19:50:03 +08:00
commit 2f1bdac921
10 changed files with 2980 additions and 0 deletions

28
config/app.yaml Normal file
View File

@@ -0,0 +1,28 @@
server:
bind: "0.0.0.0"
port: 8080
cups:
server: "http://v4.hitwh.games:631"
user: "root"
password: "lanyimin123"
# 如需指定 CUPS 服务器/用户,示例:
# cups:
# server: "http://cups.local:631"
# user: "printsvc"
scheduler:
strategy: "least_queued" # round_robin | least_queued
refresh_interval_secs: 10
retry:
attempts: 3
backoff_ms: 1500
defaults:
copies: 1
duplex: "two_sided_long_edge" # one_sided | two_sided_long_edge | two_sided_short_edge
color: "auto" # auto | color | monochrome
media: "A4"
quality: "normal" # draft | normal | high