Module: IpcAuthpipe
- Defined in:
- lib/ipcauthpipe.rb,
lib/ipcauthpipe/log.rb,
lib/ipcauthpipe/reader.rb,
lib/ipcauthpipe/handler.rb,
lib/ipcauthpipe/processor.rb,
lib/ipcauthpipe/handler/pre.rb,
lib/ipcauthpipe/handler/auth.rb,
lib/ipcauthpipe/handler/passwd.rb,
lib/ipcauthpipe/handler/enumerate.rb
Defined Under Namespace
Modules: Handler, Log Classes: AuthenticationFailed, Processor, Reader
Class Attribute Summary collapse
-
.config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
-
.init(cfgfile) ⇒ Object
Reads and stores config file and uses it’s data to initialize ActiveRecord connection.
-
.start(cfgfile) ⇒ Object
Starts the processing - initializes the configuration and feeds incoming requests to request processor.
Class Attribute Details
.config ⇒ Object (readonly)
Returns the value of attribute config.
21 22 23 |
# File 'lib/ipcauthpipe.rb', line 21 def config @config end |
Class Method Details
.init(cfgfile) ⇒ Object
Reads and stores config file and uses it’s data to initialize ActiveRecord connection
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/ipcauthpipe.rb', line 39 def init(cfgfile) # Read and parse YAML config cfgdata = YAML::load_file(cfgfile) # Create the global config object @config = OpenStruct.new cfgdata # Init logger - set up it's level and log file IpcAuthpipe::Log.init(@config.log['file'], @config.log['level']) # And init the ActiveRecord ActiveRecord::Base.establish_connection(@config.database) ActiveRecord::Base.logger = IpcAuthpipe::Log.logger # and require model classes (we can't do it before as we need initialized config to be available) require 'models/member_converge' require 'models/member' end |
.start(cfgfile) ⇒ Object
Starts the processing - initializes the configuration and feeds incoming requests to request processor
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ipcauthpipe.rb', line 25 def start(cfgfile) init cfgfile Log::info 'ipcauthpipe is started' ipc = IpcAuthpipe::Processor.new while (line = IpcAuthpipe::Reader.getline) do reply = ipc.process(line.strip) unless line.strip.empty? Log::debug "Reply is: #{reply.inspect}" STDOUT.puts reply STDOUT.flush end end |