From 6c3700a824ca4e5833e91265ac9a78a5ea6b1742 Mon Sep 17 00:00:00 2001 From: Vladimir Dementyev Date: Wed, 14 May 2025 16:28:27 -0700 Subject: [PATCH] feat: support YAML aliases in configuration So I can write my config as follows: ```yml default_gpt: &default_gpt service: open_ai model: "gpt-4o-mini" temperature: 0.5 api_key: <%= Rails.application.credentials.openai&.api_key %> development: gpt: <<: *default_gpt production: gpt: <<: *default_gpt test: gpt: service: fake_llm ``` --- lib/active_agent.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/active_agent.rb b/lib/active_agent.rb index 8e773d1d..6f37e957 100644 --- a/lib/active_agent.rb +++ b/lib/active_agent.rb @@ -49,7 +49,7 @@ def configure def load_configuration(file) if File.exist?(file) - config_file = YAML.load(ERB.new(File.read(file)).result) + config_file = YAML.load(ERB.new(File.read(file)).result, aliases: true) env = ENV["RAILS_ENV"] || ENV["ENV"] || "development" @config = config_file[env] || config_file end