Class: Journeybook::Configuration
- Inherits:
-
Object
- Object
- Journeybook::Configuration
- Defined in:
- lib/journeybook/configuration.rb
Instance Attribute Summary collapse
-
#admin_authenticator ⇒ Object
Returns the value of attribute admin_authenticator.
-
#ai_provider ⇒ Object
Returns the value of attribute ai_provider.
-
#components ⇒ Object
readonly
Returns the value of attribute components.
-
#default_layout ⇒ Object
Returns the value of attribute default_layout.
-
#form_action ⇒ Object
Returns the value of attribute form_action.
-
#form_delivery_method ⇒ Object
Returns the value of attribute form_delivery_method.
-
#form_from ⇒ Object
Returns the value of attribute form_from.
-
#form_to ⇒ Object
Returns the value of attribute form_to.
-
#openai_api_key ⇒ Object
Returns the value of attribute openai_api_key.
-
#openai_model ⇒ Object
Returns the value of attribute openai_model.
-
#postmark_api_key ⇒ Object
Returns the value of attribute postmark_api_key.
-
#s3_access_key_id ⇒ Object
Returns the value of attribute s3_access_key_id.
-
#s3_bucket ⇒ Object
Returns the value of attribute s3_bucket.
-
#s3_prefix ⇒ Object
Returns the value of attribute s3_prefix.
-
#s3_public_base_url ⇒ Object
Returns the value of attribute s3_public_base_url.
-
#s3_region ⇒ Object
Returns the value of attribute s3_region.
-
#s3_secret_access_key ⇒ Object
Returns the value of attribute s3_secret_access_key.
-
#templates ⇒ Object
readonly
Returns the value of attribute templates.
Instance Method Summary collapse
- #admin_basic_auth(username:, password:, realm: "Journeybook") ⇒ Object
- #component(name, component_class, **metadata) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/journeybook/configuration.rb', line 8 def initialize @default_layout = "application" @admin_authenticator = ->(_controller) { false } @ai_provider = :openai @openai_api_key = nil @openai_model = "gpt-5.4-mini" @postmark_api_key = nil @form_from = nil @form_to = nil @form_action = "/journeybook/form" @form_delivery_method = :postmark @s3_bucket = nil @s3_region = nil @s3_access_key_id = nil @s3_secret_access_key = nil @s3_prefix = "journeybook/#{Rails.env}" @s3_public_base_url = nil @components = ComponentRegistry.new @templates = PageTemplateRegistry.new end |
Instance Attribute Details
#admin_authenticator ⇒ Object
Returns the value of attribute admin_authenticator.
3 4 5 |
# File 'lib/journeybook/configuration.rb', line 3 def admin_authenticator @admin_authenticator end |
#ai_provider ⇒ Object
Returns the value of attribute ai_provider.
3 4 5 |
# File 'lib/journeybook/configuration.rb', line 3 def ai_provider @ai_provider end |
#components ⇒ Object (readonly)
Returns the value of attribute components.
6 7 8 |
# File 'lib/journeybook/configuration.rb', line 6 def components @components end |
#default_layout ⇒ Object
Returns the value of attribute default_layout.
3 4 5 |
# File 'lib/journeybook/configuration.rb', line 3 def default_layout @default_layout end |
#form_action ⇒ Object
Returns the value of attribute form_action.
3 4 5 |
# File 'lib/journeybook/configuration.rb', line 3 def form_action @form_action end |
#form_delivery_method ⇒ Object
Returns the value of attribute form_delivery_method.
3 4 5 |
# File 'lib/journeybook/configuration.rb', line 3 def form_delivery_method @form_delivery_method end |
#form_from ⇒ Object
Returns the value of attribute form_from.
3 4 5 |
# File 'lib/journeybook/configuration.rb', line 3 def form_from @form_from end |
#form_to ⇒ Object
Returns the value of attribute form_to.
3 4 5 |
# File 'lib/journeybook/configuration.rb', line 3 def form_to @form_to end |
#openai_api_key ⇒ Object
Returns the value of attribute openai_api_key.
3 4 5 |
# File 'lib/journeybook/configuration.rb', line 3 def openai_api_key @openai_api_key end |
#openai_model ⇒ Object
Returns the value of attribute openai_model.
3 4 5 |
# File 'lib/journeybook/configuration.rb', line 3 def openai_model @openai_model end |
#postmark_api_key ⇒ Object
Returns the value of attribute postmark_api_key.
3 4 5 |
# File 'lib/journeybook/configuration.rb', line 3 def postmark_api_key @postmark_api_key end |
#s3_access_key_id ⇒ Object
Returns the value of attribute s3_access_key_id.
3 4 5 |
# File 'lib/journeybook/configuration.rb', line 3 def s3_access_key_id @s3_access_key_id end |
#s3_bucket ⇒ Object
Returns the value of attribute s3_bucket.
3 4 5 |
# File 'lib/journeybook/configuration.rb', line 3 def s3_bucket @s3_bucket end |
#s3_prefix ⇒ Object
Returns the value of attribute s3_prefix.
3 4 5 |
# File 'lib/journeybook/configuration.rb', line 3 def s3_prefix @s3_prefix end |
#s3_public_base_url ⇒ Object
Returns the value of attribute s3_public_base_url.
3 4 5 |
# File 'lib/journeybook/configuration.rb', line 3 def s3_public_base_url @s3_public_base_url end |
#s3_region ⇒ Object
Returns the value of attribute s3_region.
3 4 5 |
# File 'lib/journeybook/configuration.rb', line 3 def s3_region @s3_region end |
#s3_secret_access_key ⇒ Object
Returns the value of attribute s3_secret_access_key.
3 4 5 |
# File 'lib/journeybook/configuration.rb', line 3 def s3_secret_access_key @s3_secret_access_key end |
#templates ⇒ Object (readonly)
Returns the value of attribute templates.
6 7 8 |
# File 'lib/journeybook/configuration.rb', line 6 def templates @templates end |
Instance Method Details
#admin_basic_auth(username:, password:, realm: "Journeybook") ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/journeybook/configuration.rb', line 37 def admin_basic_auth(username:, password:, realm: "Journeybook") @admin_authenticator = lambda do |controller| expected_username = username.to_s expected_password = password.to_s controller.authenticate_or_request_with_http_basic(realm) do |provided_username, provided_password| expected_username.present? && expected_password.present? && secure_compare(provided_username, expected_username) && secure_compare(provided_password, expected_password) end end end |
#component(name, component_class, **metadata) ⇒ Object
33 34 35 |
# File 'lib/journeybook/configuration.rb', line 33 def component(name, component_class, **) components.register(name, component_class, **) end |