confection/demo/demo.go

39 lines
1011 B
Go
Raw Normal View History

2015-01-18 17:50:03 +07:00
package main
import (
"flag"
"github.com/localhots/confection"
)
type (
Config struct {
AppName string `json:"app_name" attrs:"required" title:"Application Name"`
BuildNumber int `json:"build_number" attrs:"readonly" title:"Build Number"`
EnableSignIn bool `json:"enable_sign_in" title:"Enable Sign-In"`
DatabaseDriver string `json:"database_driver" title:"Database Driver" options:"mysql,postgresql,mssql"`
DatabaseConfig DatabaseConfig `json:"database_config"`
2015-01-18 18:31:36 +07:00
SensitiveData string `json:"sensitive_data" attrs:"ignored"`
2015-01-18 17:50:03 +07:00
}
DatabaseConfig struct {
Hostname string `json:"hostname"`
Port int `json:"port"`
Username string `json:"username"`
Password string `json:"password"`
Database string `json:"database" attrs:"required"`
}
)
2015-01-18 17:55:18 +07:00
func init() {
confection.SetupFlags()
2015-01-18 17:50:03 +07:00
flag.Parse()
2015-01-18 17:55:18 +07:00
}
2015-01-18 17:50:03 +07:00
2015-01-18 17:55:18 +07:00
func main() {
2015-01-18 17:50:03 +07:00
conf := Config{
DatabaseConfig: DatabaseConfig{},
}
manager := confection.New(conf)
manager.StartServer()
}