:orphan:

Read-write or read-only modes
==================================

The read-write mode
--------------------

When you are in the design phase, your are designing the structure file or 
setting values is some user data files, you have the role of :term:`integrator` 
or :term:`operator`. Then you need to have access to all the data, even 
those which are :term:`hidden` or :term:`disabled`\ .

In this phase, the configuration shall be in `RW` mode.


.. glossary::

   read-write
   
       In the read-write mode (RW mode), all settings are accessible and can 
       be modified. For example, a variable which has the `frozen` property
       can be modified. A `hidden` or `disabled` variable is accessible.

       We are in the rôle of an :term:`integrator` or an :term:`operator`.
       We are therefore in a situation where we are **using** this configuration.

The read-only mode 
--------------------

Once the configuration has beed designed, it is used. 
The situation is different. The configuration behaves as a system. 

.. glossary::

   read-only
   
       In the read-only mode (RO mode), the configuration cannot be modified. 
       We are **using** a configuration.
       
       In the usage mode, we are therefore in a situation where the configuration 
       cannot be changed. The configuration's data are immutable. 
       
         
RO or RW mode?
---------------

Here is an image which summarizes these explanations:

.. image:: images/read_write.png


How to enable 

By default in `rougail-cli`, the `RO` mode is activated.

If you need to enable the `RW` mode, there is an `rougail-cli` option: 

.. code-block:: bash

    env ROUGAIL_MANUAL.USE_FOR_HTTPS=true rougail -m structfile/proxy2.yml -u yaml environment --yaml.filename userdata/proxy.yml -o json --json.read_write

The output is:

.. code-block:: json

    {
      "manual": {
        "http_proxy": {
          "address": "toto.fr",
          "port": "8888"
        },
        "use_for_https": true
      }
    }


