Phil Ostler
2011-May-14 14:53 UTC
Configure Rails application per run and not per enviroment
I''ve got a Rails 3 application with some functionality I''ve
written that
I only wish to be active if I''ve specified it to be active for that
application start alone.
I can''t see how I would do this with initializers or the standard
configuration strucuture as they are set per environment and and I
don''t
want to have to go and change a configuration file everytime I want to
switch my functionality on or off.
Ideally a command-line switch would work great...
rails server -run_my_functionality=true
... but I can''t see anyway of making this work in Rails as it simply
throws out my custom argument as unknown.
I''m using JRuby to run my application, but I don''t believe
there is
anything extra that is gives me to help with this.
Any way around this or anyone come up with a neater solution for per
start configuration?
Cheers
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Hassan Schroeder
2011-May-14 15:14 UTC
Re: Configure Rails application per run and not per enviroment
On Sat, May 14, 2011 at 7:53 AM, Phil Ostler <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I''ve got a Rails 3 application with some functionality I''ve written that > I only wish to be active if I''ve specified it to be active for that > application start alone.> Ideally a command-line switch would work great... > > rails server -run_my_functionality=true > > ... but I can''t see anyway of making this work in Rails as it simply > throws out my custom argument as unknown.Set as an environment variable, e.g. prompt% run_my_functionality=true rails s Then it''s available in an initializer, environment.rb or wherever as ENV[''run_my_functionality''] HTH! -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.