Files
fleet/server/config
Rajendra kadam d94e38076b Extract Apple APNs/SCEP pair validation onto MDMConfig (#46166)
Extracts the Apple APNs/SCEP both-or-neither check out of `runServeCmd`
and puts it on `MDMConfig` as `ValidateAppleAPNSAndSCEPPair(initFatal)`.
Same pattern as `ConditionalAccessConfig.Validate`,
`AndroidAgentConfig.Validate`, and the validators added in #45583.

The call site (inside the existing `if len(toInsert) > 0` gate) goes
from six lines of inline conditional `initFatal` calls to one method
call. Behavior, error messages, and gating are unchanged.

Tests live in `server/config/config_test.go`: one smoke case plus two
error branches (APNs-only and SCEP-only). Skipped the "neither set" case
on purpose — the outer `if config.MDM.IsAppleAPNsSet() ||
config.MDM.IsAppleSCEPSet()` gate in `runServeCmd` guarantees at least
one is set before the validator is ever reached.

This is the last pure config validation left in `runServeCmd` per the
broader-plan note on #45583. Remaining `initFatal` sites are runtime
failure paths (datastore init, Redis init, MDM init wiring) which need
the injection from #45343 — those would be the next slice.

**Related issue:** Refs #33370

# Checklist for submitter

- [x] Added/updated automated tests
- [x] Input validation (validator method plus tests; no SQL/JS/shell
paths involved)
- Changes file: not applicable, internal refactor with no user-visible
behavior change


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved Apple MDM configuration validation to ensure APNs and SCEP
certificates are properly paired during setup.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/fleetdm/fleet/pull/46166?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-25 17:57:24 +02:00
..