As we deploy more and more go programs we noticed a lot of boiler plate code showing up. Also being mainly rails developers we like to have different environments for development, testing and production. Another requirement is the configuration of any database connection through a database.yml
.
Enter adeven/go_conf
To address the issues mentioned and to make setting up a new go program easier i build this package.
what does it do?
- use rails style
config/database.yml
- default write
log.
tolog/server.log
- enable usage of
GO_ENV
similiar toRAILS_ENV
- provide many useful startup flags [config, log, etc.]
how to use it?
Very easy, just install with
go get github.com/adeven/go_conf
and import it
1
|
|
and then just use it
1 2 |
|
your config/database.yml
would look something like
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
Now you can start you program like
go run main.go --config confg/mydb.yml --log log/development.log
I hope this package is as useful to you as it is to us.
Have fun.