golang-developer-roadmap icon indicating copy to clipboard operation
golang-developer-roadmap copied to clipboard

Any recommendation for configuration management package?

Open hdw868 opened this issue 3 years ago • 4 comments

There could be a lot of approach to store your configuration to some file such as JSON, YAML, TOML, INI and etc. I wonder what's the proposed way to read/write configuration file in golang?

hdw868 avatar Sep 15 '21 09:09 hdw868

@hdw868 Please provide some more explanation.

ngopher avatar Sep 16 '21 16:09 ngopher

@hdw868 Please provide some more explanation.

I edit my description : )

hdw868 avatar Sep 17 '21 11:09 hdw868

There could be a lot of approach to store your configuration to some file such as JSON, YAML, TOML, INI and etc. I wonder what's the proposed way to read/write configuration file in golang?

@hdw868 Well you can use the built-in os package to read and write files.

mofodox avatar Oct 28 '21 01:10 mofodox

Viper is good choice if you want some complicated logic and wanna keep it easier to handle. Like JSON(YAML) + env variables. But it could be overwhelmed if you have just a few variables, then os(to read) and any package to parse json or yaml or whatever you want would be enough. That is my view :) Also take a look at this list of packages

kunapyanov avatar Oct 28 '21 07:10 kunapyanov