1
0
Fork 0

Ignored attribute

This commit is contained in:
Gregory Eremin 2015-01-18 18:31:36 +07:00
parent e7d10843db
commit 0baecc0a6f
2 changed files with 6 additions and 0 deletions

View File

@ -30,6 +30,7 @@ const (
tOptions = "options" tOptions = "options"
aRequired = "required" aRequired = "required"
aReadonly = "readonly" aReadonly = "readonly"
aIgnored = "ignored"
sep = "," sep = ","
) )
@ -68,6 +69,7 @@ func (c *config) meta(prefix string) []*configField {
panic(fmt.Errorf("Config is expected to be a Struct, not %s", ckind.String())) panic(fmt.Errorf("Config is expected to be a Struct, not %s", ckind.String()))
} }
loop_over_fields:
for i := 0; i < cval.NumField(); i++ { for i := 0; i < cval.NumField(); i++ {
var ( var (
field = ctyp.Field(i) field = ctyp.Field(i)
@ -105,6 +107,9 @@ func (c *config) meta(prefix string) []*configField {
if attr == aReadonly { if attr == aReadonly {
cf.IsReadonly = true cf.IsReadonly = true
} }
if attr == aIgnored {
continue loop_over_fields
}
} }
fields = append(fields, cf) fields = append(fields, cf)

View File

@ -13,6 +13,7 @@ type (
EnableSignIn bool `json:"enable_sign_in" title:"Enable Sign-In"` EnableSignIn bool `json:"enable_sign_in" title:"Enable Sign-In"`
DatabaseDriver string `json:"database_driver" title:"Database Driver" options:"mysql,postgresql,mssql"` DatabaseDriver string `json:"database_driver" title:"Database Driver" options:"mysql,postgresql,mssql"`
DatabaseConfig DatabaseConfig `json:"database_config"` DatabaseConfig DatabaseConfig `json:"database_config"`
SensitiveData string `json:"sensitive_data" attrs:"ignored"`
} }
DatabaseConfig struct { DatabaseConfig struct {
Hostname string `json:"hostname"` Hostname string `json:"hostname"`