# HG changeset patch # User Julien Cristau # Date 1427896259 -7200 # Node ID 8cc58e8ad72fc27f562fbfb1d2203b596b3d9d1b # Parent d7c33cbdce8b62b21ad581ddbecabbf3bbd423b4 [web] Add datadir-url configuration option (closes #5204550) Makes it possible to use a different host for static data instead of ${base_url}/data diff -r d7c33cbdce8b -r 8cc58e8ad72f web/webconfig.py --- a/web/webconfig.py Tue Mar 31 10:22:05 2015 +0200 +++ b/web/webconfig.py Wed Apr 01 15:50:59 2015 +0200 @@ -124,6 +124,13 @@ 'where the cubicweb web server is listening on port 8080.', 'group': 'main', 'level': 3, }), + ('datadir-url', + {'type': 'string', 'default': None, + 'help': ('base url for static data, if different from "${base-url}/data/". ' + 'If served from a different domain, that domain should allow ' + 'cross-origin requests.'), + 'group': 'web', + }), ('auth-mode', {'type' : 'choice', 'choices' : ('cookie', 'http'), @@ -382,6 +389,14 @@ baseurl += '/' if not (self.repairing or self.creating): self.global_set_option('base-url', baseurl) + self.datadir_url = self['datadir-url'] + if self.datadir_url: + if self.datadir_url[-1] != '/': + self.datadir_url += '/' + if self.mode != 'test': + self.datadir_url += '%s/' % self.instance_md5_version() + self.https_datadir_url = self.datadir_url + return httpsurl = self['https-url'] data_relpath = self.data_relpath() if httpsurl: