mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 23:42:37 +03:00
support lists/tuples in 'serverwebroot' config item
This allows the user to specify multiple servers to put the repo to, and `fdroid server update` will automatically push to them all. fixes #22 https://gitlab.com/fdroid/fdroidserver/issues/22
This commit is contained in:
parent
35ee4b1bc5
commit
8c8fb8b156
3 changed files with 32 additions and 18 deletions
|
@ -168,12 +168,21 @@ def read_config(opts, config_file='config.py'):
|
|||
if k in config:
|
||||
config[k] = clean_description(config[k])
|
||||
|
||||
# since this is used with rsync, where trailing slashes have meaning,
|
||||
# ensure there is always a trailing slash
|
||||
if 'serverwebroot' in config:
|
||||
if config['serverwebroot'][-1] != '/':
|
||||
config['serverwebroot'] += '/'
|
||||
config['serverwebroot'] = config['serverwebroot'].replace('//', '/')
|
||||
if isinstance(config['serverwebroot'], basestring):
|
||||
roots = [config['serverwebroot']]
|
||||
elif all(isinstance(item, basestring) for item in config['serverwebroot']):
|
||||
roots = config['serverwebroot']
|
||||
else:
|
||||
raise TypeError('only accepts strings, lists, and tuples')
|
||||
rootlist = []
|
||||
for rootstr in roots:
|
||||
# since this is used with rsync, where trailing slashes have
|
||||
# meaning, ensure there is always a trailing slash
|
||||
if rootstr[-1] != '/':
|
||||
rootstr += '/'
|
||||
rootlist.append(rootstr.replace('//', '/'))
|
||||
config['serverwebroot'] = rootlist
|
||||
|
||||
return config
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue