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)')
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')