feat: use env var for ollama url
This commit is contained in:
+5
-1
@@ -7,9 +7,13 @@ use crate::providers::ollama::OllamaProvider;
|
||||
use crate::state::app_state::AppState;
|
||||
|
||||
use axum::Router;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::env;
|
||||
use std::net::SocketAddr;
|
||||
use std::sync::Arc;
|
||||
|
||||
static OLLAMA_URL: Lazy<String> = Lazy::new(|| env::var("OLLAMA_URL").expect("OLLAMA_URL not set"));
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
#[cfg(debug_assertions)]
|
||||
@@ -18,7 +22,7 @@ async fn main() {
|
||||
}
|
||||
|
||||
let state = AppState {
|
||||
ollama: Arc::new(OllamaProvider::new("http://localhost:11434")),
|
||||
ollama: Arc::new(OllamaProvider::new(OLLAMA_URL.as_str())),
|
||||
};
|
||||
|
||||
let app = Router::new()
|
||||
|
||||
Reference in New Issue
Block a user