Sha256: 934b9a76157da61358e418e006e8da2396164c206eafccee4f54c992bb6a497c

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

require "semantic_logger"
SemanticLogger.add_appender(io: STDOUT, formatter: :json)

require_relative "func_runner/version"
require_relative "func_runner/application"
require_relative "func_runner/function_definition"
require_relative "func_runner/function_execution"
require_relative "func_runner/function_execution_payload"
require_relative "func_runner/message"
require_relative "func_runner/run_result"

module FuncRunner
  class Error < StandardError; end

  class Configuration
    attr_accessor :api_key, :assistant_id, :polling_interval, :auto_update, :logger

    def initialize
      @api_key = ENV["FUNCRUNNER_API_KEY"]
      @assistant_id = nil
      @polling_interval = 5.0
      @auto_update = true
      @logger = SemanticLogger["Func Runner Application"]
    end
  end

  # Class-level access to configuration
  class << self
    attr_accessor :configuration, :app

    # Access the configuration instance
    def config
      @configuration ||= Configuration.new
    end

    def application
      @app ||= FuncRunner::Application.new
      yield @app if block_given?
      @app
    end

    # Allow block-based configuration
    def configure
      yield config if block_given?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
funcrunner-0.1.1 lib/func_runner.rb