prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Enabling the flush endpoint through env vars does not seem to work
  I'm running Kinto + postgres with docker-compose (using the example docker-compose.yml in the repo). 
  
  Adding `KINTO_FLUSH_ENDPOINT_ENABLED` to the environment section in docker-compose.yml does not enable the flush endpoint for me. I instead had to add `kinto.flush_endpoint_enabled = true` to a custom ini file, that worked.
  
  Can the flush endpoint be enabled through an env var like this?
  
  
  </issue>
  <code>
  [start of kinto/__init__.py]
  1 import pkg_resources
  2 import logging
  3 
  4 import kinto.core
  5 from pyramid.config import Configurator
  6 from pyramid.settings import asbool
  7 from pyramid.security import Authenticated
  8 
  9 from kinto.authorization import RouteFactory
  10 
  11 # Module version, as defined in PEP-0396.
  12 __version__ = pkg_resources.get_distribution(__package__).version
  13 
  14 # Implemented HTTP API Version
  15 HTTP_API_VERSION = '1.5'
  16 
  17 # Main kinto logger
  18 logger = logging.getLogger(__name__)
  19 
  20 
  21 DEFAULT_SETTINGS = {
  22     'retry_after_seconds': 3,
  23     'cache_backend': 'kinto.core.cache.memory',
  24     'permission_backend': 'kinto.core.permission.memory',
  25     'storage_backend': 'kinto.core.storage.memory',
  26     'project_docs': 'https://kinto.readthedocs.io/',
  27     'bucket_create_principals': Authenticated,
  28     'multiauth.authorization_policy': (
  29         'kinto.authorization.AuthorizationPolicy'),
  30     'experimental_collection_schema_validation': 'False',
  31     'http_api_version': HTTP_API_VERSION
  32 }
  33 
  34 
  35 def main(global_config, config=None, **settings):
  36     if not config:
  37         config = Configurator(settings=settings, root_factory=RouteFactory)
  38 
  39     # Force project name, since it determines settings prefix.
  40     config.add_settings({'kinto.project_name': 'kinto'})
  41 
  42     kinto.core.initialize(config,
  43                           version=__version__,
  44                           default_settings=DEFAULT_SETTINGS)
  45 
  46     settings = config.get_settings()
  47 
  48     # Expose capability
  49     schema_enabled = asbool(
  50         settings['experimental_collection_schema_validation']
  51     )
  52     if schema_enabled:
  53         config.add_api_capability(
  54             "schema",
  55             description="Validates collection records with JSON schemas.",
  56             url="http://kinto.readthedocs.io/en/latest/api/1.x/"
  57                 "collections.html#collection-json-schema")
  58 
  59     # Scan Kinto views.
  60     kwargs = {}
  61     flush_enabled = asbool(settings.get('flush_endpoint_enabled'))
  62 
  63     if flush_enabled:
  64         config.add_api_capability(
  65             "flush_endpoint",
  66             description="The __flush__ endpoint can be used to remove all "
  67                         "data from all backends.",
  68             url="http://kinto.readthedocs.io/en/latest/configuration/"
  69                 "settings.html#activating-the-flush-endpoint"
  70         )
  71     else:
  72         kwargs['ignore'] = 'kinto.views.flush'
  73     config.scan("kinto.views", **kwargs)
  74 
  75     app = config.make_wsgi_app()
  76 
  77     # Install middleware (idempotent if disabled)
  78     return kinto.core.install_middlewares(app, settings)
  79
  [end of kinto/__init__.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/kinto/__init__.py b/kinto/__init__.py
  --- a/kinto/__init__.py
  +++ b/kinto/__init__.py
  @@ -19,6 +19,7 @@
   
   
   DEFAULT_SETTINGS = {
  +    'flush_endpoint_enabled': False,
       'retry_after_seconds': 3,
       'cache_backend': 'kinto.core.cache.memory',
       'permission_backend': 'kinto.core.permission.memory',
  @@ -58,18 +59,18 @@
   
       # Scan Kinto views.
       kwargs = {}
  -    flush_enabled = asbool(settings.get('flush_endpoint_enabled'))
   
  +    flush_enabled = asbool(settings.get('flush_endpoint_enabled'))
       if flush_enabled:
           config.add_api_capability(
               "flush_endpoint",
               description="The __flush__ endpoint can be used to remove all "
                           "data from all backends.",
               url="http://kinto.readthedocs.io/en/latest/configuration/"
  -                "settings.html#activating-the-flush-endpoint"
  -        )
  +                "settings.html#activating-the-flush-endpoint")
       else:
           kwargs['ignore'] = 'kinto.views.flush'
  +
       config.scan("kinto.views", **kwargs)
   
       app = config.make_wsgi_app()
  
verification_info: {"golden_diff": "diff --git a/kinto/__init__.py b/kinto/__init__.py\n--- a/kinto/__init__.py\n+++ b/kinto/__init__.py\n@@ -19,6 +19,7 @@\n \n \n DEFAULT_SETTINGS = {\n+    'flush_endpoint_enabled': False,\n     'retry_after_seconds': 3,\n     'cache_backend': 'kinto.core.cache.memory',\n     'permission_backend': 'kinto.core.permission.memory',\n@@ -58,18 +59,18 @@\n \n     # Scan Kinto views.\n     kwargs = {}\n-    flush_enabled = asbool(settings.get('flush_endpoint_enabled'))\n \n+    flush_enabled = asbool(settings.get('flush_endpoint_enabled'))\n     if flush_enabled:\n         config.add_api_capability(\n             \"flush_endpoint\",\n             description=\"The __flush__ endpoint can be used to remove all \"\n                         \"data from all backends.\",\n             url=\"http://kinto.readthedocs.io/en/latest/configuration/\"\n-                \"settings.html#activating-the-flush-endpoint\"\n-        )\n+                \"settings.html#activating-the-flush-endpoint\")\n     else:\n         kwargs['ignore'] = 'kinto.views.flush'\n+\n     config.scan(\"kinto.views\", **kwargs)\n \n     app = config.make_wsgi_app()\n", "issue": "Enabling the flush endpoint through env vars does not seem to work\nI'm running Kinto + postgres with docker-compose (using the example docker-compose.yml in the repo). \n\nAdding `KINTO_FLUSH_ENDPOINT_ENABLED` to the environment section in docker-compose.yml does not enable the flush endpoint for me. I instead had to add `kinto.flush_endpoint_enabled = true` to a custom ini file, that worked.\n\nCan the flush endpoint be enabled through an env var like this?\n\n", "before_files": [{"content": "import pkg_resources\nimport logging\n\nimport kinto.core\nfrom pyramid.config import Configurator\nfrom pyramid.settings import asbool\nfrom pyramid.security import Authenticated\n\nfrom kinto.authorization import RouteFactory\n\n# Module version, as defined in PEP-0396.\n__version__ = pkg_resources.get_distribution(__package__).version\n\n# Implemented HTTP API Version\nHTTP_API_VERSION = '1.5'\n\n# Main kinto logger\nlogger = logging.getLogger(__name__)\n\n\nDEFAULT_SETTINGS = {\n    'retry_after_seconds': 3,\n    'cache_backend': 'kinto.core.cache.memory',\n    'permission_backend': 'kinto.core.permission.memory',\n    'storage_backend': 'kinto.core.storage.memory',\n    'project_docs': 'https://kinto.readthedocs.io/',\n    'bucket_create_principals': Authenticated,\n    'multiauth.authorization_policy': (\n        'kinto.authorization.AuthorizationPolicy'),\n    'experimental_collection_schema_validation': 'False',\n    'http_api_version': HTTP_API_VERSION\n}\n\n\ndef main(global_config, config=None, **settings):\n    if not config:\n        config = Configurator(settings=settings, root_factory=RouteFactory)\n\n    # Force project name, since it determines settings prefix.\n    config.add_settings({'kinto.project_name': 'kinto'})\n\n    kinto.core.initialize(config,\n                          version=__version__,\n                          default_settings=DEFAULT_SETTINGS)\n\n    settings = config.get_settings()\n\n    # Expose capability\n    schema_enabled = asbool(\n        settings['experimental_collection_schema_validation']\n    )\n    if schema_enabled:\n        config.add_api_capability(\n            \"schema\",\n            description=\"Validates collection records with JSON schemas.\",\n            url=\"http://kinto.readthedocs.io/en/latest/api/1.x/\"\n                \"collections.html#collection-json-schema\")\n\n    # Scan Kinto views.\n    kwargs = {}\n    flush_enabled = asbool(settings.get('flush_endpoint_enabled'))\n\n    if flush_enabled:\n        config.add_api_capability(\n            \"flush_endpoint\",\n            description=\"The __flush__ endpoint can be used to remove all \"\n                        \"data from all backends.\",\n            url=\"http://kinto.readthedocs.io/en/latest/configuration/\"\n                \"settings.html#activating-the-flush-endpoint\"\n        )\n    else:\n        kwargs['ignore'] = 'kinto.views.flush'\n    config.scan(\"kinto.views\", **kwargs)\n\n    app = config.make_wsgi_app()\n\n    # Install middleware (idempotent if disabled)\n    return kinto.core.install_middlewares(app, settings)\n", "path": "kinto/__init__.py"}]}