Compare commits
2 commits
9c8d60bec1
...
a424751d60
Author | SHA1 | Date | |
---|---|---|---|
a424751d60 | |||
e2c650cf56 |
3 changed files with 9 additions and 7 deletions
|
@ -11,6 +11,8 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: 🦀 Setup Rust cache
|
- name: 🦀 Setup Rust cache
|
||||||
uses: https://github.com/Swatinem/rust-cache@v2
|
uses: https://github.com/Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
cache-on-failure: "true"
|
||||||
- name: 📎 Clippy
|
- name: 📎 Clippy
|
||||||
run: cargo clippy --all -- -D warnings
|
run: cargo clippy --all -- -D warnings
|
||||||
- name: 🧪 Test
|
- name: 🧪 Test
|
||||||
|
|
12
src/app.rs
12
src/app.rs
|
@ -67,7 +67,7 @@ impl App {
|
||||||
Self
|
Self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_state(&self) -> AppState {
|
fn new_state(&self) -> Result<AppState, Error> {
|
||||||
AppState::new()
|
AppState::new()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ impl App {
|
||||||
let listener = tokio::net::TcpListener::bind(address).await?;
|
let listener = tokio::net::TcpListener::bind(address).await?;
|
||||||
tracing::info!("Listening on http://{address}");
|
tracing::info!("Listening on http://{address}");
|
||||||
|
|
||||||
let state = self.new_state();
|
let state = self.new_state()?;
|
||||||
let real_ip_header = state.i.cfg.load().real_ip_header.clone();
|
let real_ip_header = state.i.cfg.load().real_ip_header.clone();
|
||||||
let router = Router::new()
|
let router = Router::new()
|
||||||
// Prevent search indexing since artifactview serves temporary artifacts
|
// Prevent search indexing since artifactview serves temporary artifacts
|
||||||
|
@ -445,13 +445,13 @@ impl App {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AppState {
|
impl AppState {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Result<Self, Error> {
|
||||||
let cfg = Config::default();
|
let cfg = Config::new()?;
|
||||||
let cache = Cache::new(cfg.clone());
|
let cache = Cache::new(cfg.clone());
|
||||||
let api = ArtifactApi::new(cfg.clone());
|
let api = ArtifactApi::new(cfg.clone());
|
||||||
Self {
|
Ok(Self {
|
||||||
i: Arc::new(AppInner { cfg, cache, api }),
|
i: Arc::new(AppInner { cfg, cache, api }),
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Run garbage collection in the background if necessary
|
/// Run garbage collection in the background if necessary
|
||||||
|
|
|
@ -91,7 +91,7 @@ impl Default for ConfigData {
|
||||||
|
|
||||||
impl Default for Config {
|
impl Default for Config {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::new().expect("Could not initialize config")
|
Self::from_data(ConfigData::default()).unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue