Class: RedfishTools::Cli::Serve

Inherits:
Object
  • Object
show all
Defined in:
lib/redfish_tools/cli/serve.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, options) ⇒ Serve

Returns a new instance of Serve.



9
10
11
12
# File 'lib/redfish_tools/cli/serve.rb', line 9

def initialize(path, options)
  @path = path
  @options = options
end

Instance Method Details

#runObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/redfish_tools/cli/serve.rb', line 14

def run
  datastore = RedfishTools::DataStore.new(@path)
  server = RedfishTools::Server.new(datastore,
                                    @options[:user],
                                    @options[:pass],
                                    Port: @options[:port],
                                    BindAddress: @options[:bind],
                                    SSLEnable: @options[:ssl],
                                    SSLCertName: [%w[CN localhost]])
  trap("INT") { server.shutdown }
  server.start
end