diff options
author | Dan McGee <dan@archlinux.org> | 2013-01-28 14:13:53 -0700 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2013-01-28 14:13:53 -0700 |
commit | bc539b6ed174fed1545aabaa4ceb7a7f925cbbed (patch) | |
tree | 075c71853c0d236cf7a6060e87fb15b38157929f | |
parent | 7d4a8b9adf353d7adce4c3c22101e774092eb4de (diff) |
Extract torrent trackers into a settings variable
This allows them to be overridden and changed in a central location,
like we do with the SVN URL, PXE boot URL, etc.
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | releng/models.py | 5 | ||||
-rw-r--r-- | settings.py | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/releng/models.py b/releng/models.py index dd034e7f..b95f7d52 100644 --- a/releng/models.py +++ b/releng/models.py @@ -5,6 +5,7 @@ import hashlib import markdown from pytz import utc +from django.conf import settings from django.core.urlresolvers import reverse from django.db import models from django.db.models.signals import pre_save @@ -146,9 +147,9 @@ class Release(models.Model): def magnet_uri(self): query = [ ('dn', "archlinux-%s-dual.iso" % self.version), - ('tr', "udp://tracker.archlinux.org:6969"), - ('tr', "http://tracker.archlinux.org:6969/announce"), ] + if settings.TORRENT_TRACKERS: + query.extend(('tr', uri) for uri in settings.TORRENT_TRACKERS) if self.torrent_infohash: query.insert(0, ('xt', "urn:btih:%s" % self.torrent_infohash)) return "magnet:?%s" % '&'.join(['%s=%s' % (k, v) for k, v in query]) diff --git a/settings.py b/settings.py index dbc06159..c856bf57 100644 --- a/settings.py +++ b/settings.py @@ -164,6 +164,12 @@ PXEBOOT_URL = 'https://releng.archlinux.org/pxeboot/' # community bit on the end, repo.svn_root is appended) SVN_BASE_URL = 'svn://svn.archlinux.org/' +# Trackers used for ISO download magnet links +TORRENT_TRACKERS = ( + 'udp://tracker.archlinux.org:6969', + 'http://tracker.archlinux.org:6969/announce', +) + ## Import local settings from local_settings import * |