# Ruby application session parameters

**URL:** <https://www.ruby-forum.com/t/ruby-application-session-parameters/160578>\
**Category:** Ruby\
**Created:** [February 17, 2009, 11:42pm UTC](https://www.ruby-forum.com/t/ruby-application-session-parameters/160578 "2009-02-17T23:42:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e36b37/32.png) [@thomas](https://www.ruby-forum.com/u/thomas)\
**Post date:** [February 17, 2009, 11:42pm UTC](https://www.ruby-forum.com/t/ruby-application-session-parameters/160578/1 "2009-02-17T23:42:39Z")

</div>

I am trying to create multiple applications that perform different  
processes on our servers. The important aspect is that I want to  
somehow put into a session or configuration file data from all of these  
applications so we can manage the sessions from one place.

Example if XML:

 user1 pass1 false true user2 pass2 false true 

I have also tried this:  
\<conf.rb\>  
if $CURRPROC == ‘test1’  
@conf = {  
‘id’ =\> ‘test1’,  
‘user’ =\> ‘user1’,  
‘pass’ =\> ‘pass1’,  
‘err’ =\> ‘false’  
}  
end

if $CURRPROC == ‘test2’  
@conf = {  
‘id’ =\> ‘test2’,  
‘user’ =\> ‘user2’,  
‘pass’ =\> ‘pass2’,  
‘err’ =\> ‘false’  
}  
end

\<app.rb\>  
$CURRPROC = ‘test1’  
require ‘config.rb’

puts @conf[‘id’]  
puts @conf[‘log’]

This seems to work to read, but I am not sure if this is what I should  
be doing because it seems hard to change a single value and write it  
back out to the file. In this case, if an error occurred during  
processing, I want to change the ‘err’ value to ‘true’ so that future  
processing could take that into account when that process was run. I’ve  
just had a heck of at time getting to parse XML and read/write  
correctly, or getting the ruby code to save easily with small changes.  
Other examples I looked up are good for a single configuration file for  
a single application, but I am trying to have a central configuration  
file for multiple applications. Any suggestions are appreciated of  
course.
