upd(flags): configure from main fn not flags.go
This commit is contained in:
+4
-4
@@ -3,8 +3,6 @@ package main
|
||||
import (
|
||||
_ "github.com/joho/godotenv/autoload"
|
||||
"github.com/namsral/flag"
|
||||
|
||||
"github.com/crusttech/crust/rbac"
|
||||
)
|
||||
|
||||
type configuration struct {
|
||||
@@ -12,7 +10,7 @@ type configuration struct {
|
||||
dbDSN string
|
||||
}
|
||||
|
||||
func flags(prefix string) configuration {
|
||||
func flags(prefix string, mountFlags ...func()) configuration {
|
||||
var config configuration
|
||||
|
||||
p := func(s string) string {
|
||||
@@ -21,7 +19,9 @@ func flags(prefix string) configuration {
|
||||
|
||||
flag.StringVar(&config.httpAddr, p("http-addr"), ":3000", "Listen address for HTTP server")
|
||||
flag.StringVar(&config.dbDSN, p("db-dsn"), "crust:crust@tcp(db1:3306)/crust?collation=utf8mb4_general_ci", "DSN for database connection")
|
||||
rbac.Flags()
|
||||
for _, mount := range mountFlags {
|
||||
mount()
|
||||
}
|
||||
flag.Parse()
|
||||
return config
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user