|
2 | 2 | // Licensed under the Apache License, Version 2.0, see LICENSE for details. |
3 | 3 | // SPDX-License-Identifier: Apache-2.0 |
4 | 4 |
|
5 | | -use crate::admin::config::{AdminConfig, DEFAULT_INSECURE_API}; |
| 5 | +use crate::admin::config::{AdminConfig, DEFAULT_ADMIN_API_READ_ONLY, DEFAULT_INSECURE_API}; |
6 | 6 | use crate::plugins::PluginsConfig; |
7 | 7 | use crate::policy_engine::PolicyEngineConfig; |
8 | 8 | use crate::token::AttestationTokenVerifierConfig; |
@@ -83,6 +83,7 @@ impl TryFrom<&Path> for KbsConfig { |
83 | 83 | fn try_from(config_path: &Path) -> Result<Self, Self::Error> { |
84 | 84 | let c = Config::builder() |
85 | 85 | .set_default("admin.insecure_api", DEFAULT_INSECURE_API)? |
| 86 | + .set_default("admin.admin_api_read_only", DEFAULT_ADMIN_API_READ_ONLY)? |
86 | 87 | .set_default("http_server.insecure_http", DEFAULT_INSECURE_HTTP)? |
87 | 88 | .set_default("http_server.sockets", vec![DEFAULT_SOCKET])? |
88 | 89 | .set_default( |
@@ -169,6 +170,7 @@ mod tests { |
169 | 170 | admin: AdminConfig { |
170 | 171 | auth_public_key: Some(PathBuf::from("/etc/kbs-admin.pub")), |
171 | 172 | insecure_api: false, |
| 173 | + admin_api_read_only: false, |
172 | 174 | }, |
173 | 175 | policy_engine: PolicyEngineConfig { |
174 | 176 | policy_path: PathBuf::from("/etc/kbs-policy.rego"), |
@@ -218,6 +220,7 @@ mod tests { |
218 | 220 | admin: AdminConfig { |
219 | 221 | auth_public_key: None, |
220 | 222 | insecure_api: DEFAULT_INSECURE_API, |
| 223 | + admin_api_read_only: false, |
221 | 224 | }, |
222 | 225 | policy_engine: PolicyEngineConfig { |
223 | 226 | policy_path: DEFAULT_POLICY_PATH.into(), |
@@ -255,6 +258,7 @@ mod tests { |
255 | 258 | admin: AdminConfig { |
256 | 259 | auth_public_key: Some(PathBuf::from("/etc/kbs-admin.pub")), |
257 | 260 | insecure_api: false, |
| 261 | + admin_api_read_only: false, |
258 | 262 | }, |
259 | 263 | policy_engine: PolicyEngineConfig { |
260 | 264 | policy_path: PathBuf::from("/etc/kbs-policy.rego"), |
@@ -293,6 +297,7 @@ mod tests { |
293 | 297 | admin: AdminConfig { |
294 | 298 | auth_public_key: Some(PathBuf::from("/opt/confidential-containers/kbs/user-keys/public.pub")), |
295 | 299 | insecure_api: DEFAULT_INSECURE_API, |
| 300 | + admin_api_read_only: false, |
296 | 301 | }, |
297 | 302 | policy_engine: PolicyEngineConfig::default(), |
298 | 303 | plugins: Vec::new(), |
@@ -334,6 +339,7 @@ mod tests { |
334 | 339 | admin: AdminConfig { |
335 | 340 | auth_public_key: Some("/kbs/kbs.pem".into()), |
336 | 341 | insecure_api: DEFAULT_INSECURE_API, |
| 342 | + admin_api_read_only: false, |
337 | 343 | }, |
338 | 344 | policy_engine: PolicyEngineConfig::default(), |
339 | 345 | plugins: Vec::new(), |
@@ -369,6 +375,7 @@ mod tests { |
369 | 375 | admin: AdminConfig { |
370 | 376 | auth_public_key: Some("/kbs/kbs.pem".into()), |
371 | 377 | insecure_api: DEFAULT_INSECURE_API, |
| 378 | + admin_api_read_only: false, |
372 | 379 | }, |
373 | 380 | policy_engine: PolicyEngineConfig::default(), |
374 | 381 | plugins: Vec::new(), |
|
0 commit comments