Class: Binocs::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/binocs/configuration.rb', line 22

def initialize
  @enabled = true
  @retention_period = 24.hours
  @max_body_size = 64.kilobytes
  @ignored_paths = %w[/assets /packs /binocs /cable]
  @ignored_content_types = %w[image/ video/ audio/ font/]
  @basic_auth_username = nil
  @basic_auth_password = nil
  @max_requests = 1000
  @record_request_body = true
  @record_response_body = true
  @swagger_spec_url = '/api-docs'
  @swagger_ui_url = '/api-docs/index.html'
  @agent_tool = :claude_code
  @agent_worktree_base = '../binocs-agents'
  @login_path = nil  # Auto-detected from Devise if available, or set manually
  @authentication_method = nil  # e.g., :authenticate_user! or a Proc
end

Instance Attribute Details

#agent_toolObject

Returns the value of attribute agent_tool.



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

def agent_tool
  @agent_tool
end

#agent_worktree_baseObject

Returns the value of attribute agent_worktree_base.



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

def agent_worktree_base
  @agent_worktree_base
end

#authentication_methodObject

Returns the value of attribute authentication_method.



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

def authentication_method
  @authentication_method
end

#basic_auth_passwordObject

Returns the value of attribute basic_auth_password.



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

def basic_auth_password
  @basic_auth_password
end

#basic_auth_usernameObject

Returns the value of attribute basic_auth_username.



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

def basic_auth_username
  @basic_auth_username
end

#enabledObject

Returns the value of attribute enabled.



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

def enabled
  @enabled
end

#ignored_content_typesObject

Returns the value of attribute ignored_content_types.



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

def ignored_content_types
  @ignored_content_types
end

#ignored_pathsObject

Returns the value of attribute ignored_paths.



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

def ignored_paths
  @ignored_paths
end

#login_pathObject

Returns the value of attribute login_path.



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

def 
  @login_path
end

#max_body_sizeObject

Returns the value of attribute max_body_size.



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

def max_body_size
  @max_body_size
end

#max_requestsObject

Returns the value of attribute max_requests.



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

def max_requests
  @max_requests
end

#record_request_bodyObject

Returns the value of attribute record_request_body.



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

def record_request_body
  @record_request_body
end

#record_response_bodyObject

Returns the value of attribute record_response_body.



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

def record_response_body
  @record_response_body
end

#retention_periodObject

Returns the value of attribute retention_period.



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

def retention_period
  @retention_period
end

#swagger_spec_urlObject

Returns the value of attribute swagger_spec_url.



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

def swagger_spec_url
  @swagger_spec_url
end

#swagger_ui_urlObject

Returns the value of attribute swagger_ui_url.



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

def swagger_ui_url
  @swagger_ui_url
end

Instance Method Details

#basic_auth_enabled?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/binocs/configuration.rb', line 41

def basic_auth_enabled?
  basic_auth_username.present? && basic_auth_password.present?
end

#resolved_login_pathObject



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/binocs/configuration.rb', line 49

def 
  return @login_path if @login_path.present?

  # Try to auto-detect Devise login path
  if defined?(Devise) && defined?(Rails.application.routes)
    begin
      Rails.application.routes.url_helpers.new_user_session_path
    rescue NoMethodError
      # Devise might use a different scope
      '/users/sign_in'
    end
  else
    '/login'
  end
end

#swagger_enabled?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/binocs/configuration.rb', line 45

def swagger_enabled?
  swagger_spec_url.present?
end