Test: Remove the clients from AppState entirely.
Some checks failed
semver Build semver has succeeded
format Build format has succeeded
clippy Build clippy has succeeded
rust-test Build rust-test has failed
build Build build has succeeded

This commit is contained in:
Tom Alexander 2024-09-30 00:38:32 -04:00
parent e4463fe79d
commit f3b00c46ea
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 0 additions and 16 deletions

View File

@ -1,13 +1,7 @@
use std::collections::HashSet; use std::collections::HashSet;
use std::sync::Arc; use std::sync::Arc;
use kube::Client;
use crate::gitea_client::GiteaClient;
#[derive(Clone)] #[derive(Clone)]
pub(crate) struct AppState { pub(crate) struct AppState {
pub(crate) kubernetes_client: Client,
pub(crate) gitea: GiteaClient,
pub(crate) allowed_repos: Arc<HashSet<String>>, pub(crate) allowed_repos: Arc<HashSet<String>>,
} }

View File

@ -47,14 +47,6 @@ pub async fn init_tracing() -> Result<(), Box<dyn std::error::Error>> {
} }
pub async fn launch_server() -> Result<(), Box<dyn std::error::Error>> { pub async fn launch_server() -> Result<(), Box<dyn std::error::Error>> {
let kubernetes_client: Client = Client::try_default()
.await
.expect("Set KUBECONFIG to a valid kubernetes config.");
let gitea_api_root = std::env::var("WEBHOOK_BRIDGE_API_ROOT")?;
let gitea_api_token = std::env::var("WEBHOOK_BRIDGE_OAUTH_TOKEN")?;
let gitea = GiteaClient::new(gitea_api_root, gitea_api_token);
let allowed_repos = std::env::var("WEBHOOK_BRIDGE_REPO_WHITELIST")?; let allowed_repos = std::env::var("WEBHOOK_BRIDGE_REPO_WHITELIST")?;
let allowed_repos: HashSet<_> = allowed_repos let allowed_repos: HashSet<_> = allowed_repos
.split(",") .split(",")
@ -73,8 +65,6 @@ pub async fn launch_server() -> Result<(), Box<dyn std::error::Error>> {
TimeoutLayer::new(Duration::from_secs(600)), TimeoutLayer::new(Duration::from_secs(600)),
)) ))
.with_state(AppState { .with_state(AppState {
kubernetes_client,
gitea,
allowed_repos: Arc::new(allowed_repos), allowed_repos: Arc::new(allowed_repos),
}); });