Module: ContrastAgentLib

Includes:
OS
Defined in:
lib/utils/version.rb,
lib/consts.rb,
lib/utils/os.rb,
lib/contrast-agent-lib.rb

Overview

Copyright © 2023 Contrast Security, Inc. See www.contrastsecurity.com/enduser-terms-0317a for more details. frozen_string_literal: true

Defined Under Namespace

Modules: DbType, EvalOptions, InputType, OS, RuleType, Version

Constant Summary collapse

LINUX_LIB =
File.join(__dir__, '..', 'usage_files/libcontrast_c.so')
MAC_LIB =
File.join(__dir__, '..', 'usage_files/libcontrast_c.dylib')
MAC_M1_LIB =
File.join(__dir__, '..', 'usage_files/libcontrast_darwin_arm.dylib')
ALPINE_LIB =
File.join(__dir__, '..', 'usage_files/libcontrast_c_musl.so')
CONTRAST_C =

Since we need two different extensions for each platform we need to detect the used OS before loading the dynamic library.

if ContrastAgentLib::OS.linux?
  ContrastAgentLib::OS.alpine? ? ALPINE_LIB : LINUX_LIB
else
  ContrastAgentLib::OS.m1_mac? ? MAC_M1_LIB : MAC_LIB
end

Method Summary

Methods included from OS

alpine?, linux?, m1_mac?, mac?, unix?, windows?