frp icon indicating copy to clipboard operation
frp copied to clipboard

Configuration: use YAML/JSON instead of INI

Open fatedier opened this issue 3 years ago • 2 comments

In the early stage of development, i choose INI as configure format because it looks simple and easy to write.

However, with the increase of project complexity, INI can't describe complex configures. It doesn't support hierarchical configuration. We use same prefix to represent arrays or maps. It's not an elegant way and difficult to unmarshal to a struct.

We want to use YAML and JSON to replace INI in a smooth way:

  • YAML and JSON will be supported in a future v0.x relase and can fully replace INI.
  • INI is still supported in v0.x versions but will be removed in v1 versions.
  • Complicated new featrues won't be supported by INI in future release. Users who want to use those features should change their configuration format to YAML/JSON.

fatedier avatar Aug 08 '21 14:08 fatedier

maybe TOML? JSON is hard to write by a human since its commas and quotes. And YAML needs lots of spaces for indenting, which causes hard to read.

TOML will be more flexible:

  • You can indent your config if you have a complicated setup
  • You can just write a flat text file for a simple server config

fakeboboliu avatar Aug 10 '21 07:08 fakeboboliu

TOML maybe not suitable for multiple levels configurations. It's redundant.

We will support JSON and YAML first, it's widely used and easy to auto generate. And then, other format can also be supported if it can simple map file content to a golang struct.

fatedier avatar Aug 12 '21 12:08 fatedier

Is this planned in v1.0?

cloudwindy avatar May 02 '23 17:05 cloudwindy

@cloudwindy For compatibility reasons, this issue has been temporarily shelved. In the next major version, it will be directly supported, not v1, but v2.

fatedier avatar May 04 '23 02:05 fatedier