Class: LatoCms::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/lato_cms/config.rb

Overview

Config This class contains the default configuration of the engine.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/lato_cms/config.rb', line 8

def initialize
  @locales = [:en]
  @templates_path = 'config/lato_cms'

  # Admin roles exposed on Lato::User#lato_cms_admin_role and rendered
  # as a select by lato_users. Ordered map of role key => integer value;
  # labels are resolved via i18n (lato_cms.admin_roles.<key>).
  # `operator` has read/edit access; `admin` also manages pages
  # (create, update, delete) and translation links.
  @admin_roles = { none: 0, operator: 1, admin: 2 }

  # Optional OpenAI-compatible endpoint used to auto-generate alt text
  # for uploaded images (see LatoCms::Media#generate_alt_text!). All
  # three must be set for the feature to activate; unset by default.
  @llm_api_url = nil
  @llm_model = nil
  @llm_api_key = nil
end

Instance Attribute Details

#admin_rolesObject

Returns the value of attribute admin_roles.



6
7
8
# File 'lib/lato_cms/config.rb', line 6

def admin_roles
  @admin_roles
end

#llm_api_keyObject

Returns the value of attribute llm_api_key.



6
7
8
# File 'lib/lato_cms/config.rb', line 6

def llm_api_key
  @llm_api_key
end

#llm_api_urlObject

Returns the value of attribute llm_api_url.



6
7
8
# File 'lib/lato_cms/config.rb', line 6

def llm_api_url
  @llm_api_url
end

#llm_modelObject

Returns the value of attribute llm_model.



6
7
8
# File 'lib/lato_cms/config.rb', line 6

def llm_model
  @llm_model
end

#localesObject

Returns the value of attribute locales.



6
7
8
# File 'lib/lato_cms/config.rb', line 6

def locales
  @locales
end

#templates_pathObject

Returns the value of attribute templates_path.



6
7
8
# File 'lib/lato_cms/config.rb', line 6

def templates_path
  @templates_path
end

Instance Method Details

#llm_configured?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/lato_cms/config.rb', line 27

def llm_configured?
  llm_api_url.present? && llm_model.present? && llm_api_key.present?
end