From f50b975b6e8e96df90fb4de0e05af3a16bc9828e Mon Sep 17 00:00:00 2001 From: Cameron Patrick Date: Sat, 31 Jul 2004 09:43:13 +0000 Subject: [PATCH] add command-line option for using a different config file --- sql-edition/servers/VendServer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql-edition/servers/VendServer.py b/sql-edition/servers/VendServer.py index 19a7e67..125de02 100755 --- a/sql-edition/servers/VendServer.py +++ b/sql-edition/servers/VendServer.py @@ -366,6 +366,7 @@ if __name__ == '__main__': from optparse import OptionParser op = OptionParser(usage="%prog [OPTION]...") + op.add_option('-f', '--config-file', default='/etc/dispense/servers.conf', metavar='FILE', dest='config_file', help='use the specified config file instead of /etc/dispense/servers.conf') op.add_option('-v', '--virtualvend', action='store_false', default=True, dest='use_lat', help='use the virtual vending server instead of LAT') op.add_option('-n', '--hostname', dest='host', default='localhost', help='the hostname to connect to for virtual vending machine mode (default: localhost)') op.add_option('-p', '--port', dest='port', default=5150, type='int', help='the port number to connect to (default: 5150)') @@ -375,7 +376,7 @@ if __name__ == '__main__': op.error('extra command line arguments: ' + ' '.join(args)) cp = ConfigParser() - cp.read('/etc/dispense/servers.conf') + cp.read(options.config_file) DBServer = cp.get('Database', 'Server') DBName = cp.get('Database', 'Name') DBUser = cp.get('VendingMachine', 'DBUser') -- 2.20.1