##// END OF EJS Templates
hgweb: load server settings from --web-conf (issue4699)...
Yuya Nishihara -
r27184:64187e9a default
parent child Browse files
Show More
@@ -96,6 +96,16 b' def createservice(ui, repo, opts):'
96 alluis.update([repo.baseui, repo.ui])
96 alluis.update([repo.baseui, repo.ui])
97 else:
97 else:
98 baseui = ui
98 baseui = ui
99 webconf = opts.get('web_conf') or opts.get('webdir_conf')
100 if webconf:
101 # load server settings (e.g. web.port) to "copied" ui, which allows
102 # hgwebdir to reload webconf cleanly
103 servui = ui.copy()
104 servui.readconfig(webconf, sections=['web'])
105 alluis.add(servui)
106 else:
107 servui = ui
108
99 optlist = ("name templates style address port prefix ipv6"
109 optlist = ("name templates style address port prefix ipv6"
100 " accesslog errorlog certificate encoding")
110 " accesslog errorlog certificate encoding")
101 for o in optlist.split():
111 for o in optlist.split():
@@ -105,7 +115,6 b' def createservice(ui, repo, opts):'
105 for u in alluis:
115 for u in alluis:
106 u.setconfig("web", o, val, 'serve')
116 u.setconfig("web", o, val, 'serve')
107
117
108 webconf = opts.get('web_conf') or opts.get('webdir_conf')
109 if webconf:
118 if webconf:
110 app = hgwebdir_mod.hgwebdir(webconf, baseui=baseui)
119 app = hgwebdir_mod.hgwebdir(webconf, baseui=baseui)
111 else:
120 else:
@@ -113,4 +122,4 b' def createservice(ui, repo, opts):'
113 raise error.RepoError(_("there is no Mercurial repository"
122 raise error.RepoError(_("there is no Mercurial repository"
114 " here (.hg not found)"))
123 " here (.hg not found)"))
115 app = hgweb_mod.hgweb(repo, baseui=baseui)
124 app = hgweb_mod.hgweb(repo, baseui=baseui)
116 return httpservice(ui, app, opts)
125 return httpservice(servui, app, opts)
@@ -1181,6 +1181,38 b' test inexistent and inaccessible repo sh'
1181 </body>
1181 </body>
1182 </html>
1182 </html>
1183
1183
1184
1185 test listening address/port specified by web-conf (issue4699):
1186
1187 $ killdaemons.py
1188 $ cat >> paths.conf <<EOF
1189 > [web]
1190 > address = localhost
1191 > port = $HGPORT1
1192 > EOF
1193 $ hg serve -d --pid-file=hg.pid --web-conf paths.conf \
1194 > -A access-paths.log -E error-paths-9.log
1195 listening at http://*:$HGPORT1/ (bound to 127.0.0.1:$HGPORT1) (glob)
1196 $ cat hg.pid >> $DAEMON_PIDS
1197 $ get-with-headers.py localhost:$HGPORT1 '?style=raw'
1198 200 Script output follows
1199
1200
1201
1202 test --port option overrides web.port:
1203
1204 $ killdaemons.py
1205 $ hg serve -p $HGPORT2 -d -v --pid-file=hg.pid --web-conf paths.conf \
1206 > -A access-paths.log -E error-paths-10.log
1207 listening at http://*:$HGPORT2/ (bound to 127.0.0.1:$HGPORT2) (glob)
1208 $ cat hg.pid >> $DAEMON_PIDS
1209 $ get-with-headers.py localhost:$HGPORT2 '?style=raw'
1210 200 Script output follows
1211
1212
1213
1214
1215 $ killdaemons.py
1184 $ cat > collections.conf <<EOF
1216 $ cat > collections.conf <<EOF
1185 > [collections]
1217 > [collections]
1186 > $root=$root
1218 > $root=$root
@@ -1338,6 +1370,14 b' paths errors 8'
1338
1370
1339 $ cat error-paths-8.log
1371 $ cat error-paths-8.log
1340
1372
1373 paths errors 9
1374
1375 $ cat error-paths-9.log
1376
1377 paths errors 10
1378
1379 $ cat error-paths-10.log
1380
1341 collections errors
1381 collections errors
1342
1382
1343 $ cat error-collections.log
1383 $ cat error-collections.log
General Comments 0
You need to be logged in to leave comments. Login now