Module: Federails::Configuration

Defined in:
lib/federails/configuration.rb

Overview

Stores the Federails configuration in a singleton.

Constant Summary collapse

@@app_name =
nil
@@app_version =
nil
@@force_ssl =
nil
@@site_host =
nil
@@site_port =
nil
@@enable_discovery =
true
@@open_registrations =
false
@@app_layout =
nil
@@server_routes_path =
:federation
@@client_routes_path =
:app
@@base_client_controller =
'ActionController::Base'
@@remote_follow_url_method =
'federails.new_client_following_url'
@@actor_types =
{}
@@data_types =
{}

Class Method Summary collapse

Class Method Details

.open_registrationsObject



34
35
36
# File 'lib/federails/configuration.rb', line 34

def self.open_registrations
  @@open_registrations.is_a?(Proc) ? @@open_registrations.call : @@open_registrations
end

.register_actor_class(klass, config = {}) ⇒ Object



88
89
90
# File 'lib/federails/configuration.rb', line 88

def self.register_actor_class(klass, config = {})
  @@actor_types[klass.name] = config.merge(class: klass)
end

.register_data_type(klass, config = {}) ⇒ Object



96
97
98
# File 'lib/federails/configuration.rb', line 96

def self.register_data_type(klass, config = {})
  @@data_types[klass.name] = config.merge(class: klass)
end

.remote_follow_url_methodObject

Route method for remote-following requests



# File 'lib/federails/configuration.rb', line 54

.remote_follow_url_method=(value) ⇒ Object

Sets the route method for remote-following requests

The route should lead to a page displaying the remote actor and a button to follow it. Remote actor is specified in the ‘uri` query parameter.

Its value defaults to a route of the Federails client, so your application will break if you don’t use the client routes and don’t override this value.

Examples:

remote_follow_url_method 'main_app.my_custom_route_helper'

Parameters:

  • value (String)

    Route method name as used in links



71
# File 'lib/federails/configuration.rb', line 71

mattr_accessor :remote_follow_url_method

.site_host=(value) ⇒ Object



74
75
76
77
# File 'lib/federails/configuration.rb', line 74

def self.site_host=(value)
  @@site_host = value
  Federails::Engine.routes.default_url_options[:host] = value
end

.site_port=(value) ⇒ Object



79
80
81
82
# File 'lib/federails/configuration.rb', line 79

def self.site_port=(value)
  @@site_port = value
  Federails::Engine.routes.default_url_options[:port] = value
end