changeset 51:fda6e9c4f2df

Port is now settable from cmd line
author Atul Varma <varmaa@toolness.com>
date Tue, 28 Apr 2009 20:17:48 +0000
parents f78b986ecb6e
children 3071f85fb694
files openwebchat.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/openwebchat.py	Tue Apr 28 19:08:16 2009 +0000
+++ b/openwebchat.py	Tue Apr 28 20:17:48 2009 +0000
@@ -1,4 +1,5 @@
 import os
+import sys
 import math
 import re
 import httplib
@@ -150,11 +151,16 @@
                                                      code = 404)
 
 if __name__ == '__main__':
+    if len(sys.argv) > 1:
+        port = int(sys.argv[1])
+    else:
+        port = 8071
+
     CONVERSATION_FILE = 'conversation.dat'
 
     if not os.path.exists(CONVERSATION_FILE):
         open(CONVERSATION_FILE, 'w').close()
 
-    server = OpenWebChatServer(('', 42532),
+    server = OpenWebChatServer(('', port),
                                Conversation(open(CONVERSATION_FILE, 'r+w')))
     server.run()