More
This commit is contained in:
parent
1f68ca0512
commit
3599803589
43 changed files with 3578 additions and 262 deletions
|
|
@ -29,7 +29,7 @@ use tracing_subscriber::EnvFilter;
|
|||
use state::AppState;
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(name = "perfect-postcodes", about = "Perfect Postcodes property map server")]
|
||||
#[command(name = "perfect-postcode", about = "Perfect Postcode property map server")]
|
||||
struct Cli {
|
||||
/// Path to the wide property parquet file
|
||||
#[arg(long)]
|
||||
|
|
@ -74,6 +74,10 @@ struct Cli {
|
|||
/// Ollama model name for area summaries
|
||||
#[arg(long, env = "OLLAMA_MODEL", default_value = "gemma3:12b")]
|
||||
ollama_model: String,
|
||||
|
||||
/// R5 routing service URL for real-time travel times (e.g. http://r5:8003)
|
||||
#[arg(long, env = "R5_URL", default_value = "")]
|
||||
r5_url: String,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
|
|
@ -238,6 +242,11 @@ async fn main() -> anyhow::Result<()> {
|
|||
"Ollama configured: {} (model: {})",
|
||||
cli.ollama_url, cli.ollama_model
|
||||
);
|
||||
if !cli.r5_url.is_empty() {
|
||||
info!("R5 routing service configured: {}", cli.r5_url);
|
||||
} else {
|
||||
info!("R5 routing service not configured (travel time queries disabled)");
|
||||
}
|
||||
|
||||
let token_cache = Arc::new(auth::TokenCache::new());
|
||||
|
||||
|
|
@ -261,6 +270,7 @@ async fn main() -> anyhow::Result<()> {
|
|||
pocketbase_url: cli.pocketbase_url,
|
||||
ollama_url: cli.ollama_url,
|
||||
ollama_model: cli.ollama_model,
|
||||
r5_url: cli.r5_url,
|
||||
token_cache,
|
||||
});
|
||||
|
||||
|
|
@ -283,6 +293,8 @@ async fn main() -> anyhow::Result<()> {
|
|||
let state_pb = state.clone();
|
||||
let state_postcode_stats = state.clone();
|
||||
let state_area_summary = state.clone();
|
||||
let state_shorten = state.clone();
|
||||
let state_short_url = state.clone();
|
||||
|
||||
let api = Router::new()
|
||||
.route(
|
||||
|
|
@ -335,6 +347,14 @@ async fn main() -> anyhow::Result<()> {
|
|||
.route(
|
||||
"/api/area-summary",
|
||||
post(move |body| routes::post_area_summary(state_area_summary.clone(), body)),
|
||||
)
|
||||
.route(
|
||||
"/api/shorten",
|
||||
post(move |body| routes::post_shorten(state_shorten.clone(), body)),
|
||||
)
|
||||
.route(
|
||||
"/s/{code}",
|
||||
get(move |path| routes::get_short_url(state_short_url.clone(), path)),
|
||||
);
|
||||
|
||||
// Add tile routes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue