Public Access
fix: format and lint
This commit is contained in:
@@ -308,7 +308,10 @@ fn extract_metadata(entity: &Entity) -> Result<Value, Box<dyn std::error::Error>
|
||||
}
|
||||
let mut annotations = serde_json::Map::new();
|
||||
if !m.resource_type.is_empty() {
|
||||
annotations.insert("keycloak.org/resource-type".to_string(), json!(m.resource_type));
|
||||
annotations.insert(
|
||||
"keycloak.org/resource-type".to_string(),
|
||||
json!(m.resource_type),
|
||||
);
|
||||
}
|
||||
if !m.realm.is_empty() {
|
||||
annotations.insert("keycloak.org/realm".to_string(), json!(m.realm));
|
||||
@@ -465,10 +468,10 @@ fn extract_spec(entity: &Entity) -> Option<Value> {
|
||||
Some(Spec::DefectdojoSpec(s)) => {
|
||||
// DefectDojo plugin spec - parse config_json if present
|
||||
let mut spec = json!({});
|
||||
if !s.config_json.is_empty() {
|
||||
if let Ok(config) = serde_json::from_str::<Value>(&s.config_json) {
|
||||
spec = config;
|
||||
}
|
||||
if !s.config_json.is_empty()
|
||||
&& let Ok(config) = serde_json::from_str::<Value>(&s.config_json)
|
||||
{
|
||||
spec = config;
|
||||
}
|
||||
if !s.sync_status.is_empty() {
|
||||
spec["sync_status"] = json!(s.sync_status);
|
||||
@@ -478,10 +481,10 @@ fn extract_spec(entity: &Entity) -> Option<Value> {
|
||||
Some(Spec::KeycloakSpec(s)) => {
|
||||
// Keycloak plugin spec - parse config_json if present
|
||||
let mut spec = json!({});
|
||||
if !s.config_json.is_empty() {
|
||||
if let Ok(config) = serde_json::from_str::<Value>(&s.config_json) {
|
||||
spec = config;
|
||||
}
|
||||
if !s.config_json.is_empty()
|
||||
&& let Ok(config) = serde_json::from_str::<Value>(&s.config_json)
|
||||
{
|
||||
spec = config;
|
||||
}
|
||||
if !s.sync_status.is_empty() {
|
||||
spec["sync_status"] = json!(s.sync_status);
|
||||
@@ -497,10 +500,10 @@ fn extract_spec(entity: &Entity) -> Option<Value> {
|
||||
Some(Spec::DependencytrackSpec(s)) => {
|
||||
// Dependency-Track plugin spec - parse config_json if present
|
||||
let mut spec = json!({});
|
||||
if !s.config_json.is_empty() {
|
||||
if let Ok(config) = serde_json::from_str::<Value>(&s.config_json) {
|
||||
spec = config;
|
||||
}
|
||||
if !s.config_json.is_empty()
|
||||
&& let Ok(config) = serde_json::from_str::<Value>(&s.config_json)
|
||||
{
|
||||
spec = config;
|
||||
}
|
||||
if !s.sync_status.is_empty() {
|
||||
spec["sync_status"] = json!(s.sync_status);
|
||||
|
||||
+10
-10
@@ -71,16 +71,16 @@ async fn get_locations(State(state): State<YamlAdapterState>) -> Response {
|
||||
// Check cache first
|
||||
{
|
||||
let cache = state.cache.read().await;
|
||||
if let Some(ref cached) = *cache {
|
||||
if cached.cached_at.elapsed() < state.cache_ttl {
|
||||
debug!("Serving /yaml/locations from cache");
|
||||
return (
|
||||
StatusCode::OK,
|
||||
[("content-type", "text/yaml; charset=utf-8")],
|
||||
cached.data.clone(),
|
||||
)
|
||||
.into_response();
|
||||
}
|
||||
if let Some(ref cached) = *cache
|
||||
&& cached.cached_at.elapsed() < state.cache_ttl
|
||||
{
|
||||
debug!("Serving /yaml/locations from cache");
|
||||
return (
|
||||
StatusCode::OK,
|
||||
[("content-type", "text/yaml; charset=utf-8")],
|
||||
cached.data.clone(),
|
||||
)
|
||||
.into_response();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user