-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jiale Zhang <zhangjiale@linux.alibaba.com>
- Loading branch information
Showing
10 changed files
with
71 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) 2024 Alibaba Cloud | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
use anyhow::Result; | ||
use serde::Deserialize; | ||
use std::fs::File; | ||
use thiserror::Error; | ||
|
||
pub mod aa_kbc_params; | ||
|
||
pub const DEFAULT_AA_CONFIG_PATH: &str = "/etc/attestation-agent.toml"; | ||
|
||
#[derive(Clone, Debug, Deserialize)] | ||
#[allow(dead_code)] | ||
pub struct Config { | ||
/// URL Address of Attestation Service | ||
pub as_uri: String, | ||
// TODO: Add more fields that accessing AS needs. | ||
} | ||
|
||
#[derive(Error, Debug)] | ||
pub enum ConfigFileError { | ||
#[error("failed to open")] | ||
Io(#[from] std::io::Error), | ||
#[error("failed to parse")] | ||
Parse(#[from] serde_json::Error), | ||
} | ||
|
||
impl TryFrom<&str> for Config { | ||
type Error = ConfigFileError; | ||
fn try_from(config_path: &str) -> Result<Self, Self::Error> { | ||
let file = File::open(config_path)?; | ||
let cfg: Config = serde_json::from_reader(file)?; | ||
Ok(cfg) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters