summaryrefslogtreecommitdiff
path: root/doc/source/oslo_config.rst
blob: 6e772c6cadd81730f365a302567b172747134936 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
=============================
Middlewares and configuration
=============================

Middlewares can be configured in multiple fashion depending of the
application needs. Here is some use-cases: 

Configuration from the application
----------------------------------

The application code will looks like::

    from oslo_middleware import sizelimit
    from oslo_config import cfg

    conf = cfg.ConfigOpts()
    app = sizelimit.RequestBodySizeLimiter(your_wsgi_application, conf)


Configuration with paste-deploy and the oslo.config
---------------------------------------------------

The paste filter (in /etc/my_app/api-paste.ini) will looks like::

    [filter:sizelimit]
    paste.filter_factory = oslo_middleware.sizelimit:RequestBodySizeLimiter.factory
    # In case of the application doesn't use the global oslo.config 
    # object. The middleware must known the app name to load 
    # the application configuration, by setting this:
    #  oslo_config_project = my_app

    # In some cases, you may need to specify the program name for the project
    # as well.
    #  oslo_config_program = my_app-api

The oslo.config file of the application (eg: /etc/my_app/my_app.conf) will looks like::

    [oslo_middleware]
    max_request_body_size=1000


Configuration with pastedeploy only
-----------------------------------

The paste filter (in /etc/my_app/api-paste.ini) will looks like::

    [filter:sizelimit]
    paste.filter_factory = oslo_middleware.sizelimit:RequestBodySizeLimiter.factory
    max_request_body_size=1000

This will override any configuration done via oslo.config


.. note::

    healtcheck middleware does not yet use oslo.config, see :doc:`healthcheck_plugins`