Ruby application session parameters

Discussion in 'Ruby' started by Thomas D'andrea jr., Feb 17, 2009.

  1. 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:

    <session>
    <app id="test1">
    <user>user1</user>
    <pass>pass1</pass>
    <err>false</err>
    <email address="">true</email>
    </app>
    <app id="test2">
    <user>user2</user>
    <pass>pass2</pass>
    <err>false</err>
    <email address="">true</email>
    </app>
    </session>

    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.
    --
    Posted via http://www.ruby-forum.com/.
     
    Thomas D'andrea jr., Feb 17, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff Smythe
    Replies:
    3
    Views:
    1,292
    Jeff Smythe
    Jan 2, 2004
  2. Jonck van der Kogel
    Replies:
    2
    Views:
    998
    Jonck van der Kogel
    May 27, 2004
  3. Jason
    Replies:
    2
    Views:
    527
    Jonathan Mcdougall
    May 13, 2006
  4. =?Utf-8?B?Um9iSEs=?=
    Replies:
    4
    Views:
    5,351
    =?Utf-8?B?Um9iSEs=?=
    Apr 11, 2007
  5. Jazzis
    Replies:
    2
    Views:
    266
    Jazzis
    Sep 23, 2003
Loading...

Share This Page