Override config file params on the commandline?

7 posts / 0 new
Last post
Override config file params on the commandline?


Is it possible to override config file params on the commandline? This would save having to, when sharing a common virtualhere server binary, either setup multiple config files ahead of time (with appropriate license key, server name, etc.) or doing a few kludgy sed on-liners to transform a config.ini template at runtime.


Yes that sounds like a job

Yes that sounds like a job for cmd.exe substitution rather than inside virtualhere...

I may not be thinking about

I may not be thinking about it the same way you are but I really did mean the server part. I have an LTSP setup where the linux server has a chroot environment that n thin client machines boot to. these thin-client machines have no hard drive. they all share the same chroot image. it's a little like virtualization in that they each get a read-only copy of the same chroot along with all the software installed in it (including the virtualhere server daemon). the virtualhere server is installed in the chroot but to make this work properly for each thin client machine I would need to install a separate, per-machine config.ini with the proper license key. or I would need to create one on the fly, per machine when it boots.

if the individual config.ini params could be overridden on the commandline then I could put the right license keys with the right machines in the virtualhere start command and forget about the config.ini all together.

does that make sense?

Sorry i misread "client"

Sorry i misread "client" instead of server.

I have an idea. Perhaps when the server starts and reads the parameters, you could use environment variable substitution.

So for example license in the config.ini would be


then i could replace that with the environment variable you set somewhere in your config.

Does that sound useful for you?

Sorry, just getting back to

Sorry, just getting back to this... I was able to set up a simple script that echos env vars I set to a file and it seems to work as expected so the change you are proposing should work out ok.

Just to be clear - with this

Just to be clear - with this solution the virtualhere server will never change the config.ini? This is important since it is serving as a template for multiple, distinct virtualhere server processes. If one (or more) of them decides to write to it that isn't good...


Actually it would be easiest to create the config.ini dynamically like shown below then call the server all in one line.e.g:

echo $LICENSE > config.ini;echo $SERVER_NAME >> config.ini; echo $USE_AVAHI >> config.ini; etc...; ./vhusbdpi -c ./config.ini

Log in or register to post comments