-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configfile #197
base: master
Are you sure you want to change the base?
Configfile #197
Conversation
Maybe we could tweak this to follow Lua's traditional approach to modules (where the script returns the object as a "return value"). That way you wouldn't need a prefix on the option names, and you wouldn't be stuffing things into the global environment.
I'm not set on doing it this way, but it does seem like a slightly cleaner approach to me. Thoughts? |
I've been spending a few cycles thinking about this for a while now, and there's some other features I'd like to get in as well. In particular, I'd like to make sure that we catch typos in config variable names and that the Lua script have some information available to it with respect to defaults/etc. The basic idea is similar - to turn the CommandLineParser into a smarter object that can get its data from several places, so I can probably reuse a bunch of this code. Then there's also the matter of tying this in to those Lua processors that I'll be adding "any day now". |
Sean, Let me know if there are things I can help on. I made this is as proof of concept based on our talking the last time you were out here. I figured I'd make a pull request just to the get the ball started rolling. -dp |
@zard49 Just letting you know I haven't forgotten this, but it's not yet up to the top of my list. |
I've been messing around w/ a possible idea for catching typos, using lua metatables. I'll let you know if I get somewhere... Basically CommandLineParser.add_option_* would add entries to the lua option table, and then at the parse stage we would use the lua metatable __newindex stuff to set this table so we would get an error if a new key(which would be a typo of an existing option) was attempted to be added to the option table. |
No updates on this in the last year, but still something I'd like to work on, so I'm leaving this open and assigned to me. |
Add support for a Lua based configuration file for setting runtime options rather than specifying them on the command line.
Default config file is "config.lua" or it can be specified with -ll:lua_config
Lua variables corresponding to runtime variables start with the prefix “opt_” so –level becomes opt_level. “:” is replaced by “_” so “–ll:cpu” becomes opt_ll_cpu etc.
This allows for example to only specify an option on a given node e.g.
if hostname() == "foo" then
opt_level = "realm=0"
end