Class: RStyx::Server::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/rstyx/server.rb

Overview

Base server class. This does nothing really useful, instantiate subclasses such as TCPServer instead.

Direct Known Subclasses

TCPServer

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Server

Create a new server. The config hash contains the server configuration. The configuration options recognized by all Styx server subclasses are:

:root

The root directory of the filesystem you want to serve (typically an SDirectory instance)

:log

A Logger object where server-generated log messages are stored.

:auth

An authentication object. If this is a Keyring::Authinfo instance, it will use the Inferno authentication protocol to authenticate clients who connect, and only allow connections from clients with certificates signed by the same CA that signed its own certificate. If this is nil, no authentication will be required for connections.

:groups

A hash table, indexed by user names, that returns an array of groups of which a particular user is member of. If not specified, it defaults to an empty group table (which sets the group of everyone to ‘nogroup’)

:debug

Debug level, which is assigned to the logger’s level Set this to Logger::DEBUG if you want full debugging messages to appear.



993
994
995
996
997
998
999
1000
# File 'lib/rstyx/server.rb', line 993

def initialize(config)
  @root = config[:root]
  @auth = config[:auth]
  @groups = config[:groups]
  @groups ||= Hash.new(["nogroup"])
  @log = config[:log] || Logger.new(STDERR)
  @log.level = config[:debug] || Logger::WARN
end

Instance Method Details

#runObject

Start the Styx server, returning the thread of the running Styx server instance.



1016
1017
1018
1019
1020
1021
1022
# File 'lib/rstyx/server.rb', line 1016

def run
  t = Thread.new do
    @log.info("starting")
    start_server
  end
  return(t)
end