Starting mongrel with a custom command line argument

Posted by whaka on Stack Overflow See other posts from Stack Overflow or by whaka
Published on 2010-03-24T23:38:40Z Indexed on 2010/03/24 23:43 UTC
Read the original article Hit count: 230

Filed under:

I would like to be able to start a mongrel or webrick server by passing an extra command line argument that I can read somewhere inside my rails application. An example would be:

ruby script/server -p3000 --target=FOO

Here, --target is a custom switch who's value I would like to intercept in my rails application.

However, this yields the error:

server: invalid option: --target=FOO

I found mongrel documentation which mentions a -C (--config=PATH) argument specifying a full path to a yml configuration file, but specifying that switch gives the same error as above. I presume this option is deprecated.

Is there another way to accomplish this?

© Stack Overflow or respective owner

Related posts about ruby-on-rails