Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Load options from a config file

#3

Reported by Kevin Williams · January 19th, 2008 @ 07:41 PM

State: resolved
Milestone: none
Assigned to: macournoyer macournoyer

Activity

  1. Kevin Williams
    Kevin Williams
    • Milestone cleared.
    • State changed from new to open

    January 19th, 2008 @ 07:49 PM

  2. Matt Todd
    Matt Todd

    Unless someone already has some code for this or some specific requirements, I should be able to get something put together this weekend.

    I assume YAML would be an acceptable format?

    January 19th, 2008 @ 10:25 PM

  3. macournoyer
    macournoyer
    • Assigned user cleared.

    should use the same format as mongrel_cluster if possible to ease transition.

    I don't plan to work on this now, that would be a very much appreciated contribution Matt :)

    January 19th, 2008 @ 10:33 PM

  4. Matt Todd
    Matt Todd

    Here is the patch file.

    To create a configuration file:

    thin configure --other-opts...
    

    The --config/-C option used here tells thin where to put the configuration file.

    To run with the configuration in the standard location @config/thin_config.yml@:

    thin start
    

    To ignore the configuration file:

    thin start -C no --other-opts...
    

    To run a different configuration file:

    thin start -C config/thin_debug.yml
    

    Of course, @start@, @stop@, and restart all work with exactly the same behavior above.

    All tests passed accordingly (nothing changed about the behavior of the server itself) and the options have been updated as well.

    Let me know if I've missed anything.

    January 21st, 2008 @ 01:05 AM

  5. Matt Todd
    Matt Todd

    Might want to change the --config option to accept a variable param and be defined as --[no-]config to get rid of the "no" value to use no config file.

    January 21st, 2008 @ 03:09 AM

  6. macournoyer
    macournoyer

    hey thx for the patch Matt! I got a couple questionsabout it.

    I'm not sure using the config file should be the default. Mostly the config file will be used on the server, so it will contain server specific stuff (env=production, 3 servers, etc).

    But we still wanna use "thin start" to start a server in development. Which I think is the most common use case.

    Why you added a --cluster option? This can already be guessed w/ --servers (>1 = cluster)

    January 21st, 2008 @ 09:29 AM

  7. Matt Todd
    Matt Todd

    I've refactored the code since I posted it last night.

    I've removed the need for --cluster opting for --no-config on the cluster spawns since all of its options are there in ARGV already.

    Also, the default configuration file is not loaded by default but requires --config or -C to be set (without a config path attached).

    To start Thin without any configuration file:

    thin start
    

    To start with the default configuration file:

    thin start -C
    

    To start it with a different config file:

    thin start -C config/thin_debug.yml
    

    And, again, start has the same behavior for both stop and restart as long as the --config option is consistent.

    Hope that addresses both of your concerns as well as clean up the internals just a little bit.

    NOTE: This patch includes the changes from the first so it is not necessary to patch using both, just the second one. I will remove the first one just to make sure nothing is unclear.

    January 21st, 2008 @ 01:08 PM

  8. macournoyer
    macournoyer
    • Assigned user set to macournoyer

    Looking good Matt, I'll take deeper look when I get a sec and apply.

    thx a lot!

    January 21st, 2008 @ 01:34 PM

  9. Matt Todd
  10. macournoyer
    macournoyer
    • State changed from open to resolved

    Applied modified version of your patch.

    thx Matt

    January 21st, 2008 @ 11:31 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.