<commit_before>Configuration
=============

Madame doesn't necessarily need a configuration file, but it can be very helpful to create one if you want to change your server's behaviour.

Configuration file
------------------
As Flask, Madame can handle configuration in two ways.

You can choose between of those two, or use both for one to be more global and the other more specific.

From an environment variable
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Create your file wherever you want on your server. Then, you need to create an environment variable called ``MADAME_SETTINGS`` and set its value with the path of your file. ::

  $ touch /path/to/your/configfile.py
  $ export MADAME_SETTINGS=/path/to/your/configfile.py

From the root of your application
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Create the file at the root of your application.
The file name has to be ``config.py``.
::

  $ cd /path/to/your/application
  $ touch config.py

Builtin configuration values
----------------------------
You can use all of the `Flask configuration values <http://flask.pocoo.org/docs/config/#builtin-configuration-values>`_.

Madame has also its own values:

+-------------------+-------------------------------------------------------+-------------------------------------+
| Option            | Description                                           | Default value                       |
+===================+=======================================================+=====================================+
| SCHEMA_FILE       | describes the name of the schema file                 | ``None``                            |
+-------------------+-------------------------------------------------------+-------------------------------------+
| ROOT_GET          | enable/disable GET method on root                     | ``True``                            |
+-------------------+-------------------------------------------------------+-------------------------------------+
| ROOT_POST         | enable/disable POST method on root                    | ``False``                           |
+-------------------+-------------------------------------------------------+-------------------------------------+
| ROOT_DELETE       | enable/disable DELETE method on root                  | ``False``                           |
+-------------------+-------------------------------------------------------+-------------------------------------+
| COLLECTION_GET    | enable/disable GET method on collections              | ``True``                            |
+-------------------+-------------------------------------------------------+-------------------------------------+
| COLLECTION_POST   | enable/disable POST method on collections             | ``False``                           |
+-------------------+-------------------------------------------------------+-------------------------------------+
| COLLECTION_DELETE | enable/disable DELETE method on collections           | ``False``                           |
+-------------------+-------------------------------------------------------+-------------------------------------+
| ITEM_GET          | enable/disable GET method on items                    | ``True``                            |
+-------------------+-------------------------------------------------------+-------------------------------------+
| ITEM_PUT          | enable/disable PUT method on items                    | ``False``                           |
+-------------------+-------------------------------------------------------+-------------------------------------+
| ITEM_DELETE       | enable/disable DELETE method on items                 | ``False``                           |
+-------------------+-------------------------------------------------------+-------------------------------------+
| ROOT_TITLE        | sets the root title that is displayed in responses    | ``'Content'``                       |
+-------------------+-------------------------------------------------------+-------------------------------------+
| ROOT_DESCRIPTION  | sets the root title that is displayed in responses    | ``'List of collections'``           |
+-------------------+-------------------------------------------------------+-------------------------------------+

<commit_msg>Documentation updated<commit_after>Configuration
=============

Madame doesn't necessarily need a configuration file, but it can be very helpful to create one if you want to change your server's behaviour.

Configuration file
------------------
As Flask, Madame can handle configuration in two ways.

You can choose between one of those two, or use both for one to be more global and the other more specific.

From an environment variable
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Create your file wherever you want on your server. Then, you need to create an environment variable called ``MADAME_SETTINGS`` and set its value with the path of your file. ::

  $ touch /path/to/your/configfile.py
  $ export MADAME_SETTINGS=/path/to/your/configfile.py

From the root of your application
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Create the file at the root of your application.
The file name has to be ``config.py``.
::

  $ cd /path/to/your/application
  $ touch config.py

Builtin configuration values
----------------------------
You can use all of the `Flask configuration values <http://flask.pocoo.org/docs/config/#builtin-configuration-values>`_.

Here are some useful values:

+-------------------+-------------------------------------------------------+-------------------------------------+
| Option            | Description                                           | Default value                       |
+===================+=======================================================+=====================================+
| DEBUG             | enable/disable debug mode.                            | ``True``                            |
+-------------------+-------------------------------------------------------+-------------------------------------+
| MONGO_HOST        | The host name or IP address of your MongoDB server.   | ``"localhost"``                     |
+-------------------+-------------------------------------------------------+-------------------------------------+
| MONGO_PORT        | The port number of your MongoDB server.               | ``27017``                           |
+-------------------+-------------------------------------------------------+-------------------------------------+
| MONGO_USERNAME    | The user name for authentication.                     | ``None``                            |
+-------------------+-------------------------------------------------------+-------------------------------------+
| MONGO_PASSWORD    | The password for authentication.                      | ``None``                            |
+-------------------+-------------------------------------------------------+-------------------------------------+

Madame has also its own values:

+-------------------+-------------------------------------------------------+-------------------------------------+
| Option            | Description                                           | Default value                       |
+===================+=======================================================+=====================================+
| SCHEMA_FILE       | describes the name of the schema file.                | ``None``                            |
+-------------------+-------------------------------------------------------+-------------------------------------+
| ROOT_GET          | enable/disable GET method on root.                    | ``True``                            |
+-------------------+-------------------------------------------------------+-------------------------------------+
| ROOT_POST         | enable/disable POST method on root.                   | ``False``                           |
+-------------------+-------------------------------------------------------+-------------------------------------+
| ROOT_DELETE       | enable/disable DELETE method on root.                 | ``False``                           |
+-------------------+-------------------------------------------------------+-------------------------------------+
| COLLECTION_GET    | enable/disable GET method on collections.             | ``True``                            |
+-------------------+-------------------------------------------------------+-------------------------------------+
| COLLECTION_POST   | enable/disable POST method on collections.            | ``False``                           |
+-------------------+-------------------------------------------------------+-------------------------------------+
| COLLECTION_DELETE | enable/disable DELETE method on collections.          | ``False``                           |
+-------------------+-------------------------------------------------------+-------------------------------------+
| ITEM_GET          | enable/disable GET method on items.                   | ``True``                            |
+-------------------+-------------------------------------------------------+-------------------------------------+
| ITEM_PUT          | enable/disable PUT method on items.                   | ``False``                           |
+-------------------+-------------------------------------------------------+-------------------------------------+
| ITEM_DELETE       | enable/disable DELETE method on items.                | ``False``                           |
+-------------------+-------------------------------------------------------+-------------------------------------+
| ROOT_TITLE        | sets the root title that is displayed in responses.   | ``"Content"``                       |
+-------------------+-------------------------------------------------------+-------------------------------------+
| ROOT_DESCRIPTION  | sets the root title that is displayed in responses.   | ``"List of collections"``           |
+-------------------+-------------------------------------------------------+-------------------------------------+


{'fraction_non_alphanumeric': 0.46301234567901234, 'fraction_numerical': 0.0004938271604938272, 'mean_word_length': 0.6837379447954772, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6777195', 'n_tokens_mistral': 1620, 'n_tokens_neox': 1518, 'n_words': 528}