[ANN] Configuration library

217 views
Skip to first unread message

Gerardo Oscar JT

unread,
Jul 27, 2016, 2:16:03 AM7/27/16
to golang-nuts
Maybe too simple, maybe there are several solutions, but here https://github.com/fulldump/goconfig is a configuration library to avoid the over-verbosity of flag library. It also allow load configuration from a json file.

It works like this:

type myconfig struct {
    Name      string `The name of something`
    EnableLog bool   `Enable logging into logdb`
    MaxProcs  int    `Maximum number of procs`
}
c := &myconfig{
    EnableLog: true,
}
goconfig.Read(c)

Goconf is very useful in my projects, maybe it could be useful for others too.

Gerardo Oscar JT

unread,
Jul 27, 2016, 3:19:39 PM7/27/16
to golang-nuts
Oh my gosh! There are dozens of 'goconfig' projects at github and hundreds of 'configo' projects. This is crazy. I have been looking at some of them and probably fulldump/goconfig has the best logo :)  And also it is the most generic and simpler one with default values > json values > cli values precedence.

fun4all !!

Tong Sun

unread,
Jul 29, 2016, 9:49:02 AM7/29/16
to golang-nuts


On Wednesday, July 27, 2016 at 3:19:39 PM UTC-4, Gerardo Oscar JT wrote:
... I have been looking at some of them and probably fulldump/goconfig has the best logo :)  And also it is the most generic and simpler one with default values > json values > cli values precedence.

Not trying to steal other's thunder, but just to provide yet another useful one for you to consider, 

For config via json or even environment variables (and many others more), take a look at


and


Not mine, but I myself found it most useful.

Gerardo Oscar JT

unread,
Jul 29, 2016, 10:32:36 AM7/29/16
to golang-nuts
Wow incredible huge library with a lot of options, even with its own parser!
It is also possible to build hierarchical commands (like git)
I see that more like a thing to be human friendly, the human is constantly interacting with commands.

goconfig (well, this goconfig, there are 39 repositories called goconfig) is to cover easily the typical server
with a bunch of different config variables like the database, listening port, etc. and the option to load all
from a file. Attempting to be very simple to use and with code easy to read and understand.

sat...@aporeto.com

unread,
Jul 29, 2016, 10:33:21 PM7/29/16
to golang-nuts
Docopt seems awesome.

https://github.com/docopt/docopt.go

Satyam
Reply all
Reply to author
Forward
0 new messages