Search in sources :

Example 1 with ASTConfig

use of com.checkmarx.flow.config.external.ASTConfig in project cx-flow by checkmarx-ltd.

the class ConfigurationOverrider method overrideUsingConfigProvider.

private void overrideUsingConfigProvider(Optional<CxConfig> fallback, Map<String, String> overrideReport, ScanRequest request) {
    ConfigProvider configProvider = ConfigProvider.getInstance();
    String uid = MDC.get(FlowConstants.MAIN_MDC_ENTRY);
    ScaConfig scaConfiguration = configProvider.getConfiguration(uid, ScaProperties.CONFIG_PREFIX, ScaConfig.class);
    if (scaConfiguration != null) {
        log.info("Overriding SCA properties from config provider configuration");
        scaConfigOverrider.overrideScanRequestProperties(scaConfiguration, request, overrideReport);
    } else {
        Sca scaPropertiesFromConfigAsCode = fallback.map(CxConfig::getSca).orElse(null);
        scaConfigOverrider.overrideScanRequestProperties(scaPropertiesFromConfigAsCode, request, overrideReport);
    }
    ASTConfig astConfiguration = configProvider.getConfiguration(uid, AstProperties.CONFIG_PREFIX, ASTConfig.class);
    if (astConfiguration != null) {
        log.info("Overriding AST properties from config provider configuration");
        overridePropertiesAst(astConfiguration, overrideReport, request);
    }
}
Also used : Sca(com.checkmarx.sdk.dto.sca.Sca) ConfigProvider(com.checkmarx.configprovider.ConfigProvider) ASTConfig(com.checkmarx.flow.config.external.ASTConfig)

Aggregations

ConfigProvider (com.checkmarx.configprovider.ConfigProvider)1 ASTConfig (com.checkmarx.flow.config.external.ASTConfig)1 Sca (com.checkmarx.sdk.dto.sca.Sca)1