SourceForge has been redesigned. Learn more.
Close

#21 Configure via environment vars and command line

open
5
2005-05-05
2005-01-11
Reed Hedges
No

See playerstage-users thread here:
http://sourceforge.net/mailarchive/forum.php?thread_id=6293203&forum_id=8201
for the original idea from Doug Few and followups.

The feature is to override configuration from config
file (and from defauts) via environment variables or
command line options. (With comman line overriding
environment).

My proposal is this:

Env. Var: DRIVERNAME_OPTION e.g.
STAGE_WORLDFILE=somethingelse.world
Command Line: --drivername-option e.g.
--stage-worldfile somethingelse.world

Player should automatically check the environment and
command line options and replace the config file
settings for the driver to obtain through the normal
config interface.

Discussion

  • Reed Hedges

    Reed Hedges - 2005-01-11

    Logged In: YES
    user_id=39867

    A clarification and another possability:
    If a driver section isn't in the config file but you use its
    command line argument or environment variable, then that
    driver section is implicitly created in the config file data
    in Player.

    Here's another possability for the command line:

    --driver <drivername> ...driver options... --driver
    <another> ...

    e.g.

    --driver stage --provides simulation:0 --plugin libstage
    --worldfile simple.world

     
  • Reed Hedges

    Reed Hedges - 2005-05-03

    Logged In: YES
    user_id=39867

    If you don't want it gerkey I'll take it :)

     
  • Brian Gerkey

    Brian Gerkey - 2005-05-05
    • assigned_to: gerkey --> reed
     
  • Brian Gerkey

    Brian Gerkey - 2005-05-05

    Logged In: YES
    user_id=211013

    It's all yours.

    A couple of comments:

    - I'm leery of the idea of implicitly creating devices on
    the command line
    or via env vars.

    - We need to prefix all env. variables with something like
    PLAYER_, both
    for clarity and to avoid possible (even if unlikely)
    collisions with
    other env. vars.

    - The easiest way to get this done will probably be for the
    command-line /
    env var parser to stuff the (option,value) pairs that it
    finds into the
    ConfigFile object (after loading tokens from the cfg file).
    Then it's transparent to the drivers; they don't care where
    the values came from.

    - I've been wanting for a long time to look into GNU getopt for
    command-line parsing; this might be the time to give it a try.

     

Log in to post a comment.