~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to serve-branches

  • Committer: Martin Albisetti
  • Date: 2008-09-01 21:47:21 UTC
  • mfrom: (215.1.6 1.6.1)
  • Revision ID: argentina@gmail.com-20080901214721-cdlcjue6ggr6y86q
Tags: loggerhead-1.6.1
* Added --port, --host and --prefix options to serve-branches
* Fixed broken template for project browsing with start-loggerhead

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 (defaults to 8080).")
 
45
    parser.add_option("--host", dest="user_host",
 
46
                      help="Host Loggerhead should listen on.")
 
47
    parser.add_option("--prefix", dest="user_prefix",
 
48
                      help="Specify host prefix.")
43
49
    parser.add_option("--version", action="store_true", dest="show_version",
44
50
                      help="Print the software version and exit")
45
51
    return parser
82
88
    app = HTTPExceptionHandler(app)
83
89
    app = TransLogger(app)
84
90
 
 
91
    if not options.user_prefix:
 
92
        prefix = '/'
 
93
    else:
 
94
        prefix = options.user_prefix
 
95
 
85
96
    try:
86
97
        from paste.deploy.config import PrefixMiddleware
87
98
    except ImportError:
88
99
        pass
89
100
    else:
90
 
        app = PrefixMiddleware(app)
91
 
 
92
 
    httpserver.serve(app, host='0.0.0.0', port='8080')
 
101
        app = PrefixMiddleware(app, prefix=prefix)
 
102
    
 
103
    if not options.user_port:
 
104
        port = '8080'
 
105
    else:
 
106
        port = options.user_port
 
107
 
 
108
    if not options.user_host:
 
109
        host = '0.0.0.0'
 
110
    else:
 
111
        host = options.user_host
 
112
 
 
113
    httpserver.serve(app, host=host, port=port)
93
114
 
94
115
 
95
116
if __name__ == "__main__":