Module: Camunda::Workflow

Defined in:
lib/camunda/workflow.rb,
lib/camunda/workflow/version.rb

Overview

Default configuration file for camunda-workflow. These defaults can be overridden using an initializer file within a Rails application.

Examples:

override default values

Camunda::Workflow.configure do |config|
  config.engine_url = 'http://localhost:8080'
  config.engine_route_prefix = 'rest'
end

Defined Under Namespace

Classes: Configuration

Constant Summary collapse

VERSION =
'1.0.0'.freeze

Class Method Summary collapse

Class Method Details

.configurationConfiguration

Access the Configuration class

Returns:



28
29
30
# File 'lib/camunda/workflow.rb', line 28

def self.configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Note:

if HTTP Basic Auth is used with the Camunda engine, this is where you would set a camunda_user and camunda_password

Implements Configuration class and sets default instance variables. The default variables can be overridden by creating an initializer file within your rails application and setting the variables like in the example below. using the credentials from a user setup in Camunda Admin.

Examples:

'Camunda::Workflow.configure do |config|
  config.engine_url = 'http://localhost:8080'
  config.engine_route_prefix = 'rest'
end'

Yields:



21
22
23
24
# File 'lib/camunda/workflow.rb', line 21

def self.configure
  yield(configuration)
  initialize_connection
end

.initialize_connectionObject



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/camunda/workflow.rb', line 94

def self.initialize_connection
  Spyke::Base.connection = Faraday.new(url: File.join(configuration.engine_url, configuration.engine_route_prefix)) do |c|
    c.request :multipart
    c.request :json
    c.request :authorization, :basic, Camunda::Workflow.configuration.camunda_user,
              Camunda::Workflow.configuration.camunda_password

    c.use Faraday::Response::Logger, ActiveSupport::Logger.new($stdout), bodies: true if log_details?
    c.use Camunda::FirstLevelParseJSON
    c.use Camunda::Middleware::SnakeCase

    c.adapter Faraday.default_adapter
    # HTTP proxy
    c.proxy = Camunda::Workflow.configuration.http_proxy if Camunda::Workflow.configuration.http_proxy
  end
end

.log_details?Boolean

Returns:

  • (Boolean)


90
91
92
# File 'lib/camunda/workflow.rb', line 90

def self.log_details?
  defined?(Rails) && Rails.env.development?
end