Class: Ragdoll::CLI::ConfigurationLoader
- Inherits:
-
Object
- Object
- Ragdoll::CLI::ConfigurationLoader
- Defined in:
- lib/ragdoll/cli/configuration_loader.rb
Instance Method Summary collapse
- #config_exists? ⇒ Boolean
- #config_path ⇒ Object
- #create_default_config ⇒ Object
-
#initialize ⇒ ConfigurationLoader
constructor
A new instance of ConfigurationLoader.
- #load ⇒ Object
Constructor Details
#initialize ⇒ ConfigurationLoader
Returns a new instance of ConfigurationLoader.
9 10 11 |
# File 'lib/ragdoll/cli/configuration_loader.rb', line 9 def initialize @config_path = nil end |
Instance Method Details
#config_exists? ⇒ Boolean
49 50 51 |
# File 'lib/ragdoll/cli/configuration_loader.rb', line 49 def config_exists? File.exist?(config_path) end |
#config_path ⇒ Object
53 54 55 |
# File 'lib/ragdoll/cli/configuration_loader.rb', line 53 def config_path @config_path ||= ENV['RAGDOLL_CONFIG'] || File.('~/.ragdoll/config.yml') end |
#create_default_config ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ragdoll/cli/configuration_loader.rb', line 20 def create_default_config ensure_config_directory default_config = { 'llm_provider' => 'openai', 'embedding_model' => 'text-embedding-3-large', 'embedding_provider' => 'openai', 'use_unified_content' => true, 'chunk_size' => 1000, 'chunk_overlap' => 200, 'search_similarity_threshold' => 0.7, 'max_search_results' => 10, 'database_config' => { 'adapter' => 'postgresql', 'database' => 'ragdoll_development', 'host' => 'localhost', 'port' => 5432, 'username' => ENV['USER'] || 'postgres', 'auto_migrate' => true }, 'log_level' => 'warn', 'log_file' => File.('~/.ragdoll/ragdoll.log') } File.write(config_path, YAML.dump(default_config)) default_config end |
#load ⇒ Object
14 15 16 17 |
# File 'lib/ragdoll/cli/configuration_loader.rb', line 14 def load config = load_config_file configure_ragdoll(config) end |