Use optparse for command line argument parsing

optparse was already being the interface change was conflicting with it.

(imported from commit abdb153484a98a46b21fa77cc6deb00afd615720)
This commit is contained in:
Jason Michalski 2014-02-12 14:03:58 -05:00
parent 15da5628a9
commit 2530009123
1 changed files with 5 additions and 5 deletions

View File

@ -37,6 +37,10 @@ parser.add_option('--test',
action='store_true', dest='test',
help='Use the testing database and ports')
parser.add_option('--interface',
action='store', dest='interface',
default='127.0.0.1', help='Set the interface for the proxy to listen on')
(options, args) = parser.parse_args()
base_port = 9991
@ -95,11 +99,7 @@ class Resource(resource.Resource):
return proxy.ReverseProxyResource('localhost', django_port, '/'+name)
try:
try:
interface = sys.argv[1]
except IndexError:
interface = '127.0.0.1'
reactor.listenTCP(proxy_port, server.Site(Resource()), interface=interface)
reactor.listenTCP(proxy_port, server.Site(Resource()), interface=options.interface)
reactor.run()
except:
# Print the traceback before we get SIGTERM and die.