use crate::services::SharedApiServices;
use std::sync::Arc;
use tasker_shared::config::GrpcConfig;
#[derive(Clone, Debug)]
pub struct GrpcState {
pub config: Arc<GrpcConfig>,
pub services: Arc<SharedApiServices>,
}
impl GrpcState {
pub fn new(services: Arc<SharedApiServices>, grpc_config: GrpcConfig) -> Self {
Self {
config: Arc::new(grpc_config),
services,
}
}
pub fn is_auth_enabled(&self) -> bool {
self.services.is_auth_enabled()
}
pub fn check_backpressure(&self) -> Option<String> {
self.services.check_backpressure()
}
}