~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to serve-branches

  • Committer: Martin Albisetti
  • Date: 2008-08-20 18:54:51 UTC
  • mto: This revision was merged to the branch mainline in revision 218.
  • Revision ID: argentina@gmail.com-20080820185451-1qppr2yvcsyomvty
 * Allow specifying a custom port
 * Allow specifying a custom host

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
                      help="Serve user directories as ~user.")
41
41
    parser.add_option("--trunk-dir", metavar="DIR",
42
42
                      help="The directory that contains the trunk branches.")
 
43
    parser.add_option("--port", dest="user_port",
 
44
                      help="Port Loggerhead should listen on. 8080 is the default one.")
 
45
    parser.add_option("--host", dest="user_host",
 
46
                      help="Host Loggerhead should listen on.")
43
47
    parser.add_option("--version", action="store_true", dest="show_version",
44
48
                      help="Print the software version and exit")
45
49
    return parser
88
92
        pass
89
93
    else:
90
94
        app = PrefixMiddleware(app)
91
 
 
92
 
    httpserver.serve(app, host='0.0.0.0', port='8080')
 
95
    
 
96
    if not options.user_port:
 
97
        port = '8080'
 
98
    else:
 
99
        port = options.user_port
 
100
 
 
101
    if not options.user_host:
 
102
        host = '0.0.0.0'
 
103
    else:
 
104
        host = options.user_host
 
105
 
 
106
    httpserver.serve(app, host=host, port=port)
93
107
 
94
108
 
95
109
if __name__ == "__main__":