#3 ✓resolved
Kevin Williams

Load options from a config file

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

Comments and changes to this ticket

  • Kevin Williams

    Kevin Williams January 19th, 2008 @ 07:49 PM

    • Milestone cleared.
    • State changed from “new” to “open”
  • Matt Todd

    Matt Todd January 19th, 2008 @ 10:25 PM

    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?

  • macournoyer

    macournoyer January 19th, 2008 @ 10:33 PM

    • 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 :)

  • Matt Todd

    Matt Todd January 21st, 2008 @ 01:05 AM

    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.

  • Matt Todd

    Matt Todd January 21st, 2008 @ 03:09 AM

    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.

  • macournoyer

    macournoyer January 21st, 2008 @ 09:29 AM

    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)

  • Matt Todd

    Matt Todd January 21st, 2008 @ 01:08 PM

    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.

  • macournoyer

    macournoyer January 21st, 2008 @ 01:34 PM

    • Assigned user set to “macournoyer”

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

    thx a lot!

  • Matt Todd
  • macournoyer

    macournoyer January 21st, 2008 @ 11:31 PM

    • State changed from “open” to “resolved”

    Applied modified version of your patch.

    thx Matt

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Attachments

Pages