ocsigen / html_of_wiki

Other
6 stars 3 forks source link

Have Conf module for generic configuration files working #103

Open leovalais opened 5 years ago

leovalais commented 5 years ago

The idea is to have a declarative and generic way to describe what the configuration should contain, the type of the values, their default value, some checks, etc. and abstract away from the actual configuration format used.

That is, having an abstract & generic configuration declaration, say myconfig, one could read it from a YAML file using

Conf.(parse yaml_parser myconfig in_channel)

or from a JSON file using:

Conf.(parse json_parser myconfig in_channel)

This way, compatibility with dop is ensured but it lets html_of_wiki to have a more modern looking configuration file (such as hugoio or jekyll).

Part of the work has already be done (see #88).

Here is what the configuration file should contain (this is the content of some draft design file, better documentation can be found in what's already declared using Conf):

Les options en ligne de commande override les options du fichier de configuration.

** Options non-extensions
| Nom               | Type         | Valeur par défaut | Description                                             |
|-------------------+--------------+-------------------+---------------------------------------------------------|
| deploy            | bool         | false             | Liens locaux/déploiement + extension when-local         |
| templates         | string array | []                | Templates à inline dans l'ordre                         |
| versions          | string array | []                | Liste explicite des versions à gérer                    |
| build-dir         | string       | _build            | Nom du dossier de build.                                |
| remote            | string       | origin            | Nom de la remote pour le deploy                         |
| force             | bool         | false             | Force le build même sir le dossier de build existe déjà |
| commit-message    | string       | how deploy        |                                                         |
| link-check        | mapping      |                   |                                                         |
| link-check.raw    | bool         | false             |                                                         |
| link-check.silent | bool         | false             | A la priorité.                                          |

** Options d'extensions
| Nom                      | Type           | Valeur par défaut | Description                 |
|--------------------------+----------------+-------------------+-----------------------------|
| manual                   | string         |                   | Lien relatif vers le manuel |
| api                      | string/mapping |                   | Si string, == api.dir       |
| api.dir                  | string         |                   | Dossier de l'api            |
| api.client               | string         |                   | Vers le client              |
| api.server               | string         |                   | Vers le server              |
| api.default-subproject   | string         |                   |                             |
| assets                   | string/mapping |                   | Si string, ==assets.dir     |
| assets.dir               | string         |                   | Assets                      |
| assets.images            | string         |                   | Images spécifiquement       |
| menu                     | bool           |                   |                             |
| csw/client-server-switch | bool           |                   |                             |

What's already done: https://github.com/ocsigen/html_of_wiki/blob/e4314fd3a708774ef1a28a8e96b2ce77d4a13d3a/src/how.ml#L31-L77