Class: Fosm::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/fosm/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/fosm/configuration.rb', line 59

def initialize
  @base_controller          = "ApplicationController"
  @admin_authorize          = -> { true } # Override in initializer!
  @app_authorize            = ->(_level) { true } # Override in initializer!
  @current_user_method      = -> { defined?(current_user) ? current_user : nil }
  @admin_layout             = "fosm/application"
  @app_layout               = "application"
  @transition_log_strategy  = :sync
  @webhook_job_queue        = :default
  @transition_log_job_queue = :fosm_audit
  @webhooks_enabled         = true
end

Instance Attribute Details

#admin_authorizeObject

A callable that authorizes access to the /fosm/admin area. Called via instance_exec in the controller before_action. Example: -> { redirect_to root_path unless current_user&.superadmin? }



10
11
12
# File 'lib/fosm/configuration.rb', line 10

def admin_authorize
  @admin_authorize
end

#admin_layoutObject

Layout used for the admin section



22
23
24
# File 'lib/fosm/configuration.rb', line 22

def admin_layout
  @admin_layout
end

#app_authorizeObject

A callable that authorizes access to individual FOSM apps. Receives the access_level declared in the app definition. Example: ->(level) { authenticate_user! }



15
16
17
# File 'lib/fosm/configuration.rb', line 15

def app_authorize
  @app_authorize
end

#app_layoutObject

Default layout used for generated FOSM app views



25
26
27
# File 'lib/fosm/configuration.rb', line 25

def app_layout
  @app_layout
end

#base_controllerObject

The base controller class the engine’s controllers will inherit from. Set this to match your app’s ApplicationController.



5
6
7
# File 'lib/fosm/configuration.rb', line 5

def base_controller
  @base_controller
end

#current_user_methodObject

A callable that returns the current user from the controller context. Used for transition log actor tracking.



19
20
21
# File 'lib/fosm/configuration.rb', line 19

def current_user_method
  @current_user_method
end

#transition_log_job_queueObject

Queue name for Fosm::TransitionLogJob (used when transition_log_strategy = :async).

Example:

config.transition_log_job_queue = :low


49
50
51
# File 'lib/fosm/configuration.rb', line 49

def transition_log_job_queue
  @transition_log_job_queue
end

#transition_log_strategyObject

Strategy for writing transition logs.

:sync — INSERT inside the fire! transaction (strictest consistency, default) :async — SolidQueue/ActiveJob after commit (non-blocking, recommended for production) :buffered — Bulk INSERT via periodic thread flush (highest throughput, opt-in)

Example:

config.transition_log_strategy = :async


35
36
37
# File 'lib/fosm/configuration.rb', line 35

def transition_log_strategy
  @transition_log_strategy
end

#webhook_job_queueObject

Queue name for Fosm::WebhookDeliveryJob. Webhook delivery is fire-and-forget; route it to a low-priority queue to avoid competing with user-facing jobs on the default queue.

Example:

config.webhook_job_queue = :low


43
44
45
# File 'lib/fosm/configuration.rb', line 43

def webhook_job_queue
  @webhook_job_queue
end

#webhooks_enabledObject

When false, skip enqueuing WebhookDeliveryJob after every transition. Set to false if your app has no webhook subscriptions to eliminate unnecessary queue writes (reduces SQLite write pressure).

Example:

config.webhooks_enabled = false


57
58
59
# File 'lib/fosm/configuration.rb', line 57

def webhooks_enabled
  @webhooks_enabled
end