| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import os | 5 import os |
| 6 | 6 |
| 7 IS_DEV_APP_SERVER = os.environ['SERVER_SOFTWARE'].startswith('Development') | 7 IS_DEV_APP_SERVER = os.environ['SERVER_SOFTWARE'].startswith('Development') |
| 8 | 8 |
| 9 DEFAULT = { | 9 DEFAULT = { |
| 10 'bucket': '/gs/chrome-devtools-frontend/%s', | 10 'bucket': '/gs/chrome-devtools-frontend/%s', |
| 11 'max_age': 7 * 24 * 60, # in seconds | 11 'hash_path': 'hash/%s', |
| 12 'max_age': 7 * 24 * 60 * 60, # in seconds |
| 13 'meta_path': 'meta/%s', |
| 12 'revision_path': 'revs/%s', | 14 'revision_path': 'revs/%s', |
| 13 'version_path': 'vers/%s', | 15 'version_path': 'vers/%s', |
| 14 'zip_path': 'zips/%s.zip', | 16 'zip_path': 'zips/%s.zip', |
| 15 } | 17 } |
| 16 | 18 |
| 17 class ConfigHelper: | 19 class ConfigHelper: |
| 18 def __init__(self, conf): | 20 def __init__(self, conf): |
| 19 self.conf = conf | 21 self.conf = conf |
| 20 | 22 |
| 21 def get_full_path(self, path): | 23 def get_full_path(self, path): |
| 22 return self.conf['bucket'] % path | 24 return self.conf['bucket'] % path |
| 23 | 25 |
| 26 def get_hash_path(self, hash): |
| 27 return self.conf['hash_path'] % hash |
| 28 |
| 29 def get_meta_path(self, rev): |
| 30 return self.conf['meta_path'] % rev |
| 31 |
| 24 def get_max_age(self): | 32 def get_max_age(self): |
| 25 return self.conf['max_age'] | 33 return self.conf['max_age'] |
| 26 | 34 |
| 27 def get_revision_path(self, rev): | 35 def get_revision_path(self, rev): |
| 28 return self.conf['revision_path'] % rev | 36 return self.conf['revision_path'] % rev |
| 29 | 37 |
| 30 def get_version_path(self, ver): | 38 def get_version_path(self, ver): |
| 31 return self.conf['version_path'] % ver | 39 return self.conf['version_path'] % ver |
| 32 | 40 |
| 33 def get_zip_path(self, name): | 41 def get_zip_path(self, name): |
| 34 return self.conf['zip_path'] % name | 42 return self.conf['zip_path'] % name |
| OLD | NEW |