Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/fabric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,16 @@ pub struct AuditEntry {
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Policy {
pub repo: String,
#[serde(default = "default_true")]
#[serde(default = "crate::state::default_true")]
pub require_signed: bool,
#[serde(default = "default_true")]
#[serde(default = "crate::state::default_true")]
pub require_check_strict: bool,
#[serde(default)]
pub allowed_branches: Vec<String>, // empty = all
#[serde(default)]
pub blocked_env_keys: Vec<String>,
}

fn default_true() -> bool {
true
}

impl Default for Policy {
fn default() -> Self {
Self {
Expand Down
6 changes: 1 addition & 5 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,10 @@ pub async fn set_policy(
pub struct CheckReq {
pub baseline_hash: String,
pub current_hash: String,
#[serde(default = "default_true")]
#[serde(default = "crate::state::default_true")]
pub strict: bool,
}

fn default_true() -> bool {
true
}

#[derive(Debug, Serialize)]
pub struct CheckResp {
pub drifted: bool,
Expand Down
2 changes: 1 addition & 1 deletion src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct Runtime {
pub pinned: bool,
}

fn default_true() -> bool {
pub(crate) fn default_true() -> bool {
true
}

Expand Down
Loading