pub fn resolve_rndc_config_from_deprecated(
rndc_keys: Option<&RndcKeyConfig>,
rndc_secret_ref: Option<&RndcSecretRef>,
_role: ServerRole,
) -> RndcKeyConfigExpand description
Resolve RNDC configuration with backward compatibility for deprecated fields.
Handles migration from the deprecated rndc_secret_ref field to the new rndc_keys field.
If both are present, rndc_keys takes precedence.
§Arguments
rndc_keys- New RNDC configuration field (preferred)rndc_secret_ref- Deprecated RNDC secret reference (for backward compatibility)role- Server role (Primary or Secondary)
§Returns
Resolved RndcKeyConfig. If only the deprecated field is present, converts it to the new format.
§Examples
use bindy::crd::{RndcKeyConfig, RndcSecretRef, RndcAlgorithm, ServerRole};
use bindy::reconcilers::bind9instance::config::resolve_rndc_config_from_deprecated;
// New field takes precedence
let new_config = Some(RndcKeyConfig {
auto_rotate: true,
rotate_after: "30d".to_string(),
secret_ref: None,
secret: None,
algorithm: RndcAlgorithm::HmacSha256,
});
let resolved = resolve_rndc_config_from_deprecated(new_config.as_ref(), None, ServerRole::Primary);
assert!(resolved.auto_rotate);