Class: ClaudeAgentServer::Config

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

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
# File 'lib/claude_agent_server/config.rb', line 8

def initialize
  @host = ENV.fetch('CLAUDE_SERVER_HOST', '0.0.0.0')
  @port = ENV.fetch('CLAUDE_SERVER_PORT', '9292').to_i
  @auth_token = ENV.fetch('CLAUDE_SERVER_AUTH_TOKEN', nil)
  @cors_origins = ENV.fetch('CLAUDE_SERVER_CORS_ORIGINS', '*')
  @session_ttl = ENV.fetch('CLAUDE_SERVER_SESSION_TTL', '3600').to_i
  @max_sessions = ENV.fetch('CLAUDE_SERVER_MAX_SESSIONS', '100').to_i
  @default_sdk_options = {}
  @log_level = ENV.fetch('CLAUDE_SERVER_LOG_LEVEL', 'info')
end

Instance Attribute Details

#auth_tokenObject

Returns the value of attribute auth_token.



5
6
7
# File 'lib/claude_agent_server/config.rb', line 5

def auth_token
  @auth_token
end

#cors_originsObject

Returns the value of attribute cors_origins.



5
6
7
# File 'lib/claude_agent_server/config.rb', line 5

def cors_origins
  @cors_origins
end

#default_sdk_optionsObject

Returns the value of attribute default_sdk_options.



5
6
7
# File 'lib/claude_agent_server/config.rb', line 5

def default_sdk_options
  @default_sdk_options
end

#hostObject

Returns the value of attribute host.



5
6
7
# File 'lib/claude_agent_server/config.rb', line 5

def host
  @host
end

#log_levelObject

Returns the value of attribute log_level.



5
6
7
# File 'lib/claude_agent_server/config.rb', line 5

def log_level
  @log_level
end

#max_sessionsObject

Returns the value of attribute max_sessions.



5
6
7
# File 'lib/claude_agent_server/config.rb', line 5

def max_sessions
  @max_sessions
end

#portObject

Returns the value of attribute port.



5
6
7
# File 'lib/claude_agent_server/config.rb', line 5

def port
  @port
end

#session_ttlObject

Returns the value of attribute session_ttl.



5
6
7
# File 'lib/claude_agent_server/config.rb', line 5

def session_ttl
  @session_ttl
end

Instance Method Details

#allowed_originsObject



23
24
25
26
27
# File 'lib/claude_agent_server/config.rb', line 23

def allowed_origins
  return ['*'] if @cors_origins == '*'

  @cors_origins.split(',').map(&:strip)
end

#auth_enabled?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/claude_agent_server/config.rb', line 19

def auth_enabled?
  !@auth_token.nil? && !@auth_token.empty?
end