Пример #1
0
 def from_json(self, datastring):
     try:
         if len(datastring) > cfg.CONF.max_json_body_size:
             msg = _('JSON body size (%(len)s bytes) exceeds maximum '
                     'allowed size (%(limit)s bytes).'
                     ) % {'len': len(datastring),
                          'limit': cfg.CONF.max_json_body_size}
             raise exception.RequestLimitExceeded(message=msg)
         return jsonutils.loads(datastring)
     except ValueError as ex:
         raise webob.exc.HTTPBadRequest(six.text_type(ex))
Пример #2
0
def serve(server, worker=None):
    global _launcher
    if _launcher:
        raise RuntimeError(_('serve() can only be called once'))

    _launcher = service.launch(CONF, server, workers=worker)
Пример #3
0
from miper.common.i18n import _LW


LOG = logging.getLogger(__name__)
URL_LENGTH_LIMIT = 50000

api_opts = [
    cfg.IPOpt('bind_host', default='0.0.0.0',
              help='Address to bind the server'),
    cfg.IntOpt('bind_port', default='8081',
               help='the port on which the server will listen.'),
    cfg.IntOpt('backlog', default=4096,
               help="Number of backlog requests "
                    "to configure the socket with."),
    cfg.StrOpt('cert_file',
               help=_("Location of the SSL certificate file to use for SSL mode.")),
    cfg.StrOpt('key_file',
               help=_("Location of the SSL key file to use for enabling SSL mode.")),
    cfg.IntOpt('workers', default=0,
               help='number of workers for miper service.'),
    cfg.IntOpt('max_header_line', default=16384,
               help='Maximum line size of message headers to be accepted. '
                    'max_header_line may need to be increased when using '
                    'large tokens (typically those generated by the '
                    'Keystone v3 API with big service catalogs).'),
    cfg.IntOpt('tcp_keepidle', default=600,
               help='The value for the socket option TCP_KEEPIDLE.  This is '
                    'the time in seconds that the connection must be idle '
                    'before TCP starts sending keepalive probes.'),
]
api_group = cfg.OptGroup('miper_api')