Skip to main content

create_enabled

Function create_enabled 

Source
pub fn create_enabled(create: Option<&CreateBehavior>) -> bool
Expand description

Whether the operator should create the repository when it does not yet exist.

Pure resolver shared by the controller and tests so the “absent means create” default cannot fork: an absent spec.create resolves to true (create on first use), and an explicit create.enabled is honored as written. Repository create/connect is idempotent, so create-on is the least-surprise default; set create.enabled: false to opt out.

use kopiur_api::common::{create_enabled, CreateBehavior};

assert!(create_enabled(None)); // absent → create on
assert!(create_enabled(Some(&CreateBehavior::default())));
let off = CreateBehavior { enabled: false, ..CreateBehavior::default() };
assert!(!create_enabled(Some(&off)));