# frozen_string_literal: true require 'ffi' require 'json' require_relative 'alamojoe/version' module AlamojoeCLib extend FFI::Library # set environment variables ENV['EXSEC_RUNTIME_LANGUAGE'] = 'RUBY' ENV['EXSEC_RUNTIME_LANGUAGE_VERSION'] = RUBY_VERSION ENV['EXSEC_APP_DIR'] = Dir.pwd ffi_lib (__dir__ + '/libcore.so') attach_function :configure, [:string], :int end module Alamojoe def self.configure(args) puts('args', args) puts('args.class', args.class) if args.is_a?(Hash) args[:sdk_version] = Alamojoe::VERSION return Alamojoe.configure(args.to_json) else err_msg = '[ERROR] [fnGuard] configuration error. config values must be a hash, i.e., {policy_group_name: "my_policy_group_name"}' puts(err_msg) raise err_msg end end end