Rhisis icon indicating copy to clipboard operation
Rhisis copied to clipboard

YAML configuration

Open Eastrall opened this issue 4 years ago • 1 comments

Since the begining of the project, Rhisis have been using the JSON data structure to define the servers configuration. It allows us have a defined data structure such as:

{
  "DatabaseConfiguration": {
    "host": "localhost",
    "port": 3306,
    "username": "dba_user",
    "password": "this_is_dba_user_passwor",
    "database": "dbname",
    "useEncryption": false
  }
}

It is a nice format, readable and understable by most developers and non-developers. In the future, the goal is that Rhisis is used by non-developers so I believe we can improve the way we write Rhisis configuration. YAML could be a very interesting option. It provides a really simple and clear notation, like this:

DatabaseConfiguration:
  host: localhost
  port: 3306
  username: dba_user
  password: this_is_dba_user_passwor
  database: dbname
  useEncryption: false

For this data structure, both are really simple, but imagine, we need to configure the world server with custom maps Current configuration:

{
  "worldServer": {
    "host": "127.0.0.1",
    "port": 5400,
    "id": 2,
    "clusterId": 1,
    "name": "Channel 1",
    "maps": [
      "WI_WORLD_MADRIGAL",
      "WI_DUNGEON_FL_MAS",
      "WI_WORLD_TEST"
    ],
    ...
  }
}

it's YAML equivalent would be:

worldServer:
  host: 127.0.0.1
  port: 5400
  id: 2
  clusterId: 1
  name: Channel 1
  maps:
  - WI_WORLD_MADRIGAL
  - WI_DUNGEON_FL_MAS
  - WI_WORLD_TEST
...

On a developer perspective, the format is different, but does the same job. If we think with a non-developer perspective, JSON format can be scary because of the brackets and stuff. The YAML configuration format looks cleaner thean JSON (less double quotes, and tokens) and is also more readable.

I personally think this could be an interesting feature to implement for v0.6. I'm totally open for discussion about this topic, feel free to expose your thoughts.

Eastrall avatar May 18 '20 17:05 Eastrall

Will just post what I more or less tried to convey on discord, YAML will get those who think brackets are scary into the indentation problem most likely. To be fair, if rhisis wants the less tech savvy to be able to setup everything a gui / console like installer / configurator will be more in place. Both YAML and JSON are fine imo

YoniSL avatar May 19 '20 10:05 YoniSL