PIIPolicyResolver adapts ResolvePIIPolicy to pii.PolicyResolver for pii.WithPolicyResolver. The middleware carries the resolved model config as `any` (the MODEL_CONFIG context value, a *config.ModelConfig); this asserts it back and applies the instance-wide defaults.
()
| 365 | // `any` (the MODEL_CONFIG context value, a *config.ModelConfig); this asserts |
| 366 | // it back and applies the instance-wide defaults. |
| 367 | func (a *Application) PIIPolicyResolver() pii.PolicyResolver { |
| 368 | return func(modelCfg any) (bool, []string) { |
| 369 | cfg, ok := modelCfg.(*config.ModelConfig) |
| 370 | if !ok { |
| 371 | return false, nil |
| 372 | } |
| 373 | return a.ResolvePIIPolicy(cfg) |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | // MITMCA returns the cloudproxy MITM proxy's CA, or nil when the |
| 378 | // MITM listener is disabled. |
no test coverage detected