38
38
allow_writes=False,
40
parser.add_option("--user-dirs", action="store_true", dest="user_dirs",
40
parser.add_option("--user-dirs", action="store_true",
41
41
help="Serve user directories as ~user.")
42
42
parser.add_option("--trunk-dir", metavar="DIR",
43
43
help="The directory that contains the trunk branches.")
46
46
"(defaults to 8080)."))
47
47
parser.add_option("--host", dest="user_host",
48
48
help="Host Loggerhead should listen on.")
49
parser.add_option('--memory-profile', action='store_true',
50
dest='memory_profile',
51
help='Profile the memory usage using Dozer.')
49
parser.add_option("--protocol", dest="protocol",
50
help=("Protocol to use: http, scgi, fcgi, ajp"
51
"(defaults to http)."))
52
parser.add_option("--memory-profile", action="store_true",
53
help="Profile the memory usage using Dozer.")
52
54
parser.add_option("--prefix", dest="user_prefix",
53
55
help="Specify host prefix.")
54
parser.add_option("--profile", action="store_true", dest="profile",
56
parser.add_option("--profile", action="store_true",
55
57
help="Generate callgrind profile data to "
56
58
"%d-stats.callgrind on each request.")
57
parser.add_option("--reload", action="store_true", dest="reload",
59
parser.add_option("--reload", action="store_true",
58
60
help="Restarts the application when changing python"
59
61
" files. Only used for development purposes.")
60
parser.add_option('--log-folder', dest="log_folder",
61
type=str, help="The directory to place log files in.")
62
parser.add_option("--log-folder",
63
help="The directory to place log files in.")
62
64
parser.add_option("--version", action="store_true", dest="show_version",
63
65
help="Print the software version and exit")
64
66
parser.add_option("--use-cdn", action="store_true", dest="use_cdn",
65
67
help="Serve YUI from Yahoo!'s CDN")
66
68
parser.add_option("--cache-dir", dest="sql_dir",
67
69
help="The directory to place the SQL cache in")
68
parser.add_option('--allow-writes', action='store_true',
70
parser.add_option("--allow-writes", action="store_true",
69
71
help="Allow writing to the Bazaar server.")
73
75
class LoggerheadConfig(object):
74
'''A configuration object.'''
76
"""A configuration object."""
76
78
def __init__(self, argv=None):
87
89
def get_option(self, option):
88
90
"""Get the value for the config option, either
89
from ~/.bazaar/bazaar.conf or from the command line.
90
All loggerhead-specific settings start with 'http_'"""
91
from ~/.bazaar/bazaar.conf or from the command line.
92
All loggerhead-specific settings start with 'http_'
91
94
global_config = config.GlobalConfig().get_user_option('http_'+option)
92
95
cmd_config = getattr(self._options, option)
93
96
if global_config is not None and (
94
cmd_config is None or cmd_config is False):
97
cmd_config is None or cmd_config is False):
95
98
return global_config