Class: ActionMCP::Server::Configuration
- Inherits:
-
Object
- Object
- ActionMCP::Server::Configuration
- Defined in:
- lib/action_mcp/server/configuration.rb
Overview
Configuration loader for ActionMCP server
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#adapter_name(env = nil) ⇒ Object
Get the adapter name for the current environment.
-
#adapter_options(env = nil) ⇒ Object
Get the adapter options for the current environment.
-
#for_env(env = nil) ⇒ Object
Get the configuration for the current environment.
-
#initialize(config_path = nil) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(config_path = nil) ⇒ Configuration
Returns a new instance of Configuration.
12 13 14 15 |
# File 'lib/action_mcp/server/configuration.rb', line 12 def initialize(config_path = nil) @config_path = config_path || default_config_path @config = load_config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/action_mcp/server/configuration.rb', line 10 def config @config end |
Instance Method Details
#adapter_name(env = nil) ⇒ Object
Get the adapter name for the current environment
24 25 26 27 |
# File 'lib/action_mcp/server/configuration.rb', line 24 def adapter_name(env = nil) env_config = for_env(env) env_config["adapter"] end |
#adapter_options(env = nil) ⇒ Object
Get the adapter options for the current environment
30 31 32 33 |
# File 'lib/action_mcp/server/configuration.rb', line 30 def (env = nil) env_config = for_env(env) env_config.except("adapter") end |
#for_env(env = nil) ⇒ Object
Get the configuration for the current environment
18 19 20 21 |
# File 'lib/action_mcp/server/configuration.rb', line 18 def for_env(env = nil) environment = env || (defined?(Rails) ? Rails.env : "development") config[environment] || config["development"] || {} end |