def topic(self): myExt = Extension('myExtension') myExt.add_module(config_key='key', class_name='class', multiple=False) myExt.add_handler('/my_route', HealthcheckHandler) return myExt
# -*- coding: utf-8 -*- # System imports # Third-party imports from derpconf.config import Config from tc_core import Extension, Extensions # Local imports from thumbor_aliases.handlers.aliases import UrlAliasesHandler extension = Extension('thumbor_aliases') # Register modules for settings extension.add_module(config_key='ALIASES_STORAGE', class_name='AliasesStorage', multiple=False) # Register main handler extension.add_handler(UrlAliasesHandler.regex(), UrlAliasesHandler) # Define settings Config.define('ALIASES_STORAGE', 'thumbor_aliases.storages.yml_file', 'Aliases storage class', 'URL Aliases') Config.define('ALIASES_STORAGE_FILE', '~/aliases.yml', 'Aliases file name') Extensions.register(extension)
# Copyright (c) 2015, thumbor-community # Use of this source code is governed by the MIT license that can be # found in the LICENSE file. from derpconf.config import Config from tc_core import Extension, Extensions from tc_shortener.handlers.shortener import UrlShortenerHandler extension = Extension('tc_shortener') # Register the required modules extension.add_module( config_key='SHORTENER_GENERATOR', class_name='Generator', multiple=False ) extension.add_module( config_key='SHORTENER_STORAGE', class_name='Storage', multiple=False ) Config.define('SHORTENER_GENERATOR', 'tc_shortener.generators.short_generator', 'Shortened URL generator class.', 'Shortener') Config.define('SHORTENER_STORAGE', 'tc_shortener.storages.redis_storage', 'Shortened URL storage.', 'Shortener') Config.define('SHORTENER_GENERATOR_PRESERVE_NAME', True, 'Should the URL generator preserve the image name in the URL?', 'Shortener') Config.define('SHORTENER_REDIS_STORAGE_SERVER_HOST', 'localhost', 'Redis hostname.', 'Shortener')
# -*- coding: utf-8 -*- # Copyright (c) 2015, thumbor-community # Use of this source code is governed by the MIT license that can be # found in the LICENSE file. from derpconf.config import Config from tc_core import Extension, Extensions from tc_shortener.handlers.shortener import UrlShortenerHandler extension = Extension('tc_shortener') # Register the required modules extension.add_module(config_key='SHORTENER_GENERATOR', class_name='Generator', multiple=False) extension.add_module(config_key='SHORTENER_STORAGE', class_name='Storage', multiple=False) Config.define('SHORTENER_GENERATOR', 'tc_shortener.generators.short_generator', 'Shortened URL generator class.', 'Shortener') Config.define('SHORTENER_STORAGE', 'tc_shortener.storages.redis_storage', 'Shortened URL storage.', 'Shortener') Config.define('SHORTENER_GENERATOR_PRESERVE_NAME', True, 'Should the URL generator preserve the image name in the URL?', 'Shortener')