Restructure config file

This commit is contained in:
Joscha 2023-08-17 00:28:58 +02:00
parent 225250ed4e
commit a54e842478
18 changed files with 258 additions and 216 deletions

View file

@ -8,7 +8,7 @@ use futures::TryStreamExt;
use sqlx::SqlitePool;
use crate::{
config::Config,
config::ServerConfig,
server::{
util,
web::{
@ -41,7 +41,7 @@ struct Page {
pub async fn get_commit_by_hash(
path: PathCommitByHash,
State(config): State<&'static Config>,
State(config): State<&'static ServerConfig>,
State(db): State<SqlitePool>,
) -> somehow::Result<Response> {
let base = Base::new(config, Tab::None);

View file

@ -12,7 +12,7 @@ use time::OffsetDateTime;
use tracing::debug;
use crate::{
config::Config,
config::ServerConfig,
server::web::{
base::{Base, Link, Tab},
paths::{PathGraph, PathGraphData},
@ -112,7 +112,7 @@ struct Page {
pub async fn get_graph(
_path: PathGraph,
State(config): State<&'static Config>,
State(config): State<&'static ServerConfig>,
State(db): State<SqlitePool>,
) -> somehow::Result<impl IntoResponse> {
let metrics =

View file

@ -4,7 +4,7 @@ use futures::TryStreamExt;
use sqlx::SqlitePool;
use crate::{
config::Config,
config::ServerConfig,
server::web::{
base::{Base, Tab},
link::LinkCommit,
@ -29,7 +29,7 @@ struct IndexTemplate {
pub async fn get_index(
_path: PathIndex,
State(config): State<&'static Config>,
State(config): State<&'static ServerConfig>,
State(db): State<SqlitePool>,
) -> somehow::Result<impl IntoResponse> {
let base = Base::new(config, Tab::Index);

View file

@ -13,7 +13,7 @@ use futures::TryStreamExt;
use sqlx::SqlitePool;
use crate::{
config::Config,
config::ServerConfig,
server::{
util,
web::{
@ -161,7 +161,7 @@ struct PageInner {
pub async fn get_queue_inner(
_path: PathQueueInner,
State(config): State<&'static Config>,
State(config): State<&'static ServerConfig>,
State(db): State<SqlitePool>,
State(workers): State<Arc<Mutex<Workers>>>,
) -> somehow::Result<impl IntoResponse> {
@ -182,7 +182,7 @@ struct Page {
pub async fn get_queue(
_path: PathQueue,
State(config): State<&'static Config>,
State(config): State<&'static ServerConfig>,
State(db): State<SqlitePool>,
State(workers): State<Arc<Mutex<Workers>>>,
) -> somehow::Result<impl IntoResponse> {
@ -210,7 +210,7 @@ struct PageDelete {
pub async fn get_queue_delete(
path: PathQueueDelete,
State(config): State<&'static Config>,
State(config): State<&'static ServerConfig>,
State(db): State<SqlitePool>,
) -> somehow::Result<Response> {
let base = Base::new(config, Tab::Queue);

View file

@ -8,7 +8,7 @@ use futures::TryStreamExt;
use sqlx::SqlitePool;
use crate::{
config::Config,
config::ServerConfig,
server::{
util,
web::{
@ -52,7 +52,7 @@ struct PageFinished {
async fn from_finished_run(
id: &str,
config: &'static Config,
config: &'static ServerConfig,
db: &SqlitePool,
) -> somehow::Result<Option<Response>> {
let Some(run) = sqlx::query!(
@ -146,7 +146,7 @@ async fn from_finished_run(
pub async fn get_run_by_id(
path: PathRunById,
State(config): State<&'static Config>,
State(config): State<&'static ServerConfig>,
State(db): State<SqlitePool>,
) -> somehow::Result<Response> {
if let Some(response) = from_finished_run(&path.id, config, &db).await? {

View file

@ -9,7 +9,7 @@ use axum::{
use sqlx::SqlitePool;
use crate::{
config::Config,
config::ServerConfig,
server::{
util,
web::{
@ -58,7 +58,7 @@ async fn status(status: &WorkerStatus, db: &SqlitePool, base: &Base) -> somehow:
pub async fn get_worker_by_name(
path: PathWorkerByName,
State(config): State<&'static Config>,
State(config): State<&'static ServerConfig>,
State(db): State<SqlitePool>,
State(workers): State<Arc<Mutex<Workers>>>,
) -> somehow::Result<Response> {