Initial commit
This commit is contained in:
66
internal/config/default.go
Normal file
66
internal/config/default.go
Normal file
@@ -0,0 +1,66 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/spf13/viper"
|
||||
"hub.cybercinch.nz/guisea/go-template/internal/config/key"
|
||||
)
|
||||
|
||||
// fields is the config fields with their default values and descriptions
|
||||
var fields = []*Field{
|
||||
// LOGS
|
||||
{
|
||||
key.LogsWrite,
|
||||
true,
|
||||
"Write logs to file",
|
||||
},
|
||||
{
|
||||
key.LogsLevel,
|
||||
"info",
|
||||
`Logs level.
|
||||
Available options are: (from less to most verbose)
|
||||
fatal, error, warn, info, debug`,
|
||||
},
|
||||
{
|
||||
key.LogsReportCaller,
|
||||
false,
|
||||
"Whether the logger should report the caller location.",
|
||||
},
|
||||
//{
|
||||
// key.TenantId,
|
||||
// "some_client_id",
|
||||
// "The TenantID to use with Xero.",
|
||||
//},
|
||||
//{
|
||||
// key.BankAccountId,
|
||||
// "a-random-bank-account-id",
|
||||
// "Guid for the xero account to use.",
|
||||
//},
|
||||
// END LOGS
|
||||
// BEANSTALK
|
||||
//{
|
||||
// key.BeanstalkServer,
|
||||
// "localhost",
|
||||
// "The Beanstalk Server to use",
|
||||
//},
|
||||
//{
|
||||
// key.BeanstalkPort,
|
||||
// "11300",
|
||||
// "The port to communicate with Beanstalk server",
|
||||
//},
|
||||
//{
|
||||
// key.BeanstalkTube,
|
||||
// "visa-transactions",
|
||||
// "The tube to use to find our transactions in.",
|
||||
//},
|
||||
}
|
||||
|
||||
func setDefaults() {
|
||||
Default = make(map[string]*Field, len(fields))
|
||||
for _, f := range fields {
|
||||
Default[f.Key] = f
|
||||
viper.SetDefault(f.Key, f.DefaultValue)
|
||||
viper.MustBindEnv(f.Key)
|
||||
}
|
||||
}
|
||||
|
||||
var Default map[string]*Field
|
||||
Reference in New Issue
Block a user