def get_app(self): component = Component() component.configurations = { 'proxies': [ { 'name': 'upstream', 'upstream_url': 'http://xxxxx.upstream.test/', 'request_path_regex': '/upstream/(.*)', 'request_path_sub': '/\1', } ] } component.install() return Application(component.urls)
def get_app(self): component = Component() component.configurations = { 'proxies': [ { 'name': 'upstream', 'upstream_url': 'http://upstream.test', 'request_path_regex': r'/upstream/(.*)', 'request_path_sub': r'/\1', 'pool_max_workers': 1, 'pool_auto_spawn': False, } ] } component.install() return Application(component.urls)
def main(ctx, config, daemon, pidfile, stdin, stdout, stderr, directory, umask): """Entry of Blackgate command.""" if not config: config = read_default_config() else: config = read_yaml_config(config) if not config: ctx.fail('config not found.') try: config = parse_yaml_config(config) except ValueError: ctx.fail('config is not valid yaml.') component = Component() component.configurations = config component.install() application = Application(component.urls) # FIXME: is there a better place to put this piece of code? if component.configurations.get('sentry'): try: from raven.contrib.tornado import AsyncSentryClient dsn = component.configurations.get('sentry', {}).get('dsn') if dsn: application.sentry_client = AsyncSentryClient(dsn) except ImportError: ctx.fail( 'You have configured `sentry`, but `raven` library not detected. Try `pip install raven`.' ) server = Server(pidfile, stdin, stdout, stderr, directory, umask) server.set_app(application) server.set_port(config.get('port') or 9654) ctx.obj = {} ctx.obj['server'] = server ctx.obj['daemon'] = daemon
def main(ctx, config, daemon, pidfile, stdin, stdout, stderr, directory, umask): """Entry of Blackgate command.""" if not config: config = read_default_config() else: config = read_yaml_config(config) if not config: ctx.fail('config not found.') try: config = parse_yaml_config(config) except ValueError: ctx.fail('config is not valid yaml.') component = Component() component.configurations = config component.install() application = Application(component.urls) # FIXME: is there a better place to put this piece of code? if component.configurations.get('sentry'): try: from raven.contrib.tornado import AsyncSentryClient dsn = component.configurations.get('sentry', {}).get('dsn') if dsn: application.sentry_client = AsyncSentryClient(dsn) except ImportError: ctx.fail('You have configured `sentry`, but `raven` library not detected. Try `pip install raven`.') server = Server(pidfile, stdin, stdout, stderr, directory, umask) server.set_app(application) server.set_port(config.get('port') or 9654) ctx.obj = {} ctx.obj['server'] = server ctx.obj['daemon'] = daemon