| # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import os |
| |
| IS_DEV_APP_SERVER = os.environ['SERVER_SOFTWARE'].startswith('Development') |
| |
| DEFAULT = { |
| 'bucket': '/chrome-devtools-frontend/%s', |
| 'hash_path': 'hash/%s', |
| 'max_age': 7 * 24 * 60 * 60, # in seconds |
| 'meta_path': 'meta/%s', |
| 'revision_path': 'revs/%s', |
| 'version_path': 'vers/%s', |
| 'zip_path': 'zips/%s.zip', |
| } |
| |
| class ConfigHelper: |
| def __init__(self, conf): |
| self.conf = conf |
| |
| def get_full_path(self, path): |
| return self.conf['bucket'] % path |
| |
| def get_hash_path(self, hash): |
| return self.conf['hash_path'] % hash |
| |
| def get_meta_path(self, rev): |
| return self.conf['meta_path'] % rev |
| |
| def get_max_age(self): |
| return self.conf['max_age'] |
| |
| def get_revision_path(self, rev): |
| return self.conf['revision_path'] % rev |
| |
| def get_version_path(self, ver): |
| return self.conf['version_path'] % ver |
| |
| def get_zip_path(self, name): |
| return self.conf['zip_path'] % name |