From: Cameron Patrick Date: Sat, 31 Jul 2004 09:43:13 +0000 (+0000) Subject: add command-line option for using a different config file X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=44268d2fe00aff222bd83753739d9f9728632e2e;p=zanchey%2Fdispense2.git add command-line option for using a different config file --- 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')