Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration: use YAML/JSON instead of INI #2521

Closed
fatedier opened this issue Aug 8, 2021 · 4 comments · Fixed by #3599
Closed

Configuration: use YAML/JSON instead of INI #2521

fatedier opened this issue Aug 8, 2021 · 4 comments · Fixed by #3599
Labels

Comments

@fatedier
Copy link
Owner

fatedier commented Aug 8, 2021

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 fatedier added the todo label Aug 8, 2021
@fakeboboliu
Copy link
Contributor

fakeboboliu commented Aug 10, 2021

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

@fatedier
Copy link
Owner Author

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.

@cloudwindy
Copy link

Is this planned in v1.0?

@fatedier
Copy link
Owner Author

fatedier commented May 4, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants