TShock
TShock copied to clipboard
RFC/Discussion: New configs
The new configuration service should use something that's a bit easier to read and edit than JSON. I'm proposing that we use YAML for this.
Questions and comments are appreciated!
Not sure why we're making that change - yaml is even more prone to breakage than JSON given how much it relies on correct indentation and such.
Not sure why we're making that change - yaml is even more prone to breakage than JSON given how much it relies on correct indentation and such.
Pretty sure the reason many people have seeked this change for some time now is because YAML is more user friendly regardless. Indentation is still a smaller issue than having a non-functional config because you missed a closing bracket or parenthesis.
From the top of my head, YAML has the following benefits over JSON:
- Doesn't require you to encapsulate every string in "parenthesis" reducing the margin for mistakes;
- Has comments, which lets us have docs directly on the file, as well as more easily enable/disable features by commenting them in/out;
- Is easier to read to the common user, and accepting verbose words such as "yes/no" for boolean values once again reduces the margin for error.
I think JSON is more pragmatic, and for developers that are used to deal with it, you can more easily be certain it will work. But it's worth noting that a good subset of Orion users, be them server owners or friends just trying to bring up a server to play, aren't developers -- and will have a harder time dealing with JSON by default.
Another option is TOML. Idk what people think of using that: it looks a lot closer to .ini
s.
On a more technical level, this will be the interface:
[InstancedService]
public interface IConfigurationService {
void AddParser(/* type??? depends on what we use */ parser); // For custom type parsing
void Parse<T>(string input);
string Write<T>(T value);
}
The general idea is to call AddParser
for special parsing, such as, e.g., an IGroup
parser which would take a group name and look up the group from a table.
The reason why I picked JSON over YAML originally was because of the indentation issues. I've seen a lot of server software plagued by issues related to formatting config files and syntax. JSON is clear cut.
This is a total bikeshed, and I think if we even want to consider changing it should move to TOML over YAML.
On Fri, Sep 20, 2019 at 9:25 PM, Kevin Zhao < [email protected] > wrote:
Another option is TOML ( https://github.com/toml-lang/toml ). Idk what people think of using that: it looks a lot closer to.ini s.
On a more technical level, this will be the interface:
[ InstancedService ] public interface IConfigurationService { void AddParser ( /* type??? depends on what we use */ parser); // For custom type parsing void Parse < T >( string input ); string Write < T >( T value ); }
The general idea is to call AddParser for special parsing, such as, e.g., an IGroup parser which would take a group name and look up the group from a table.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub ( https://github.com/Pryaxis/TShock/issues/1678?email_source=notifications&email_token=AAECBJ6POKRN7DF3S2SXLY3QKWO5FA5CNFSM4IYEBWN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7IKCRI#issuecomment-533766469 ) , or mute the thread ( https://github.com/notifications/unsubscribe-auth/AAECBJ6KXKHQWUP7BMFBICLQKWO5FANCNFSM4IYEBWNQ ).
This is fairly bikeshed-y but it's fair to bring up, in my mind. I would not mind TOML over YAML, but also I see no pressing reason to change the markup language. The problem is everybody has a different preference as to markup language.