26 lines
649 B
Ruby
26 lines
649 B
Ruby
require 'webrick'
|
|
require_relative 'routes/zombi'
|
|
require_relative 'routes/cmd'
|
|
require_relative 'routes/log'
|
|
|
|
module WZombi
|
|
class Server
|
|
def initialize(config)
|
|
@config = config
|
|
end
|
|
|
|
def start
|
|
server = WEBrick::HTTPServer.new(Port: @config.puerto)
|
|
|
|
server.mount_proc('/zombi.ps1', &Routes::Zombi.new(@config).method(:call))
|
|
server.mount_proc('/cmd', &Routes::Cmd.new(@config).method(:call))
|
|
server.mount_proc('/log', &Routes::Log.new(@config).method(:call))
|
|
|
|
trap("INT") { server.shutdown }
|
|
|
|
puts "[W-ZOMBI] Servidor corriendo en puerto #{@config.puerto}"
|
|
server.start
|
|
end
|
|
end
|
|
end
|