|
| 1 | +================= |
| 2 | +Migrating to YAML |
| 3 | +================= |
| 4 | + |
| 5 | +Rodhaj now uses an new config format, YAML. |
| 6 | +Previously, the project utilized an ENV file for configuration, but |
| 7 | +due to issues such as the inability for better structured data and others, |
| 8 | +the project has migrated to YAML. |
| 9 | + |
| 10 | +The details of the motivation can be found in |
| 11 | +`PR #59 <https://github.com/transprogrammer/rodhaj/pull/59>`_. |
| 12 | + |
| 13 | +.. note:: |
| 14 | + |
| 15 | + - ``*.yaml`` files are ignored and not read by the config loader. Ensure that your YAML file uses the ``*.yml`` file extension. |
| 16 | + - The config file is stored in the same location as the ``.env`` file. It will always be read under ``bot/config.yml``. |
| 17 | + |
| 18 | +Changes |
| 19 | +======= |
| 20 | + |
| 21 | +Grouped entries |
| 22 | +--------------- |
| 23 | + |
| 24 | +The bot token, and others are merged into one mapping. This mapping key is denoted |
| 25 | +by ``rodhaj``. Any and all configuration options in relation to the bot can be found |
| 26 | +under that mapping. |
| 27 | + |
| 28 | +To illustrate, an example comparison of the old and new config format is shown below: |
| 29 | + |
| 30 | +``.env`` |
| 31 | + |
| 32 | +.. code-block:: bash |
| 33 | +
|
| 34 | + TOKEN=... |
| 35 | + DEV_MODE=False |
| 36 | +
|
| 37 | +``config.yml`` |
| 38 | + |
| 39 | +.. code-block:: yaml |
| 40 | +
|
| 41 | + rodhaj: |
| 42 | + token: ... |
| 43 | + dev_mode: False # This key-value pair can also be removed to disable the dev mode feature |
| 44 | +
|
| 45 | +Rodhaj's Guild ID can now be set via the config |
| 46 | +----------------------------------------------- |
| 47 | + |
| 48 | +Instead of hardcoding the Guild ID into the code, to allow for flexibity in development, |
| 49 | +the Guild ID can now be set via the config. This is acheived through the ``guild_id`` entry as illustrated. |
| 50 | + |
| 51 | +.. code-block:: yaml |
| 52 | +
|
| 53 | + rodhaj: |
| 54 | + guild_id: 1234567890 # This ID is the guild that is associated with Rodhaj for operations |
| 55 | +
|
| 56 | +PostgreSQL Connection URI |
| 57 | +------------------------- |
| 58 | + |
| 59 | +The PostgreSQL URI is mostly the same, but is now under the ``postgres_uri`` entry. |
0 commit comments