Sha256: 639a042b61547233f60bf5ce508fe04c397c6eae3815298e18764fbb51161805

Contents?: true

Size: 770 Bytes

Versions: 1

Compression:

Stored size: 770 Bytes

Contents

# 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)
      if args.is_a?(Hash)
        args[:sdk_version] = Alamojoe::VERSION
        return AlamojoeCLib.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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alamojoe-0.2.9 lib/alamojoe.rb