@@ -40,15 +40,15 @@ func main() {
40
40
func Run () error {
41
41
f := flags {}
42
42
var sqlLogLevel int
43
- flag .StringVar (& f .Config . PostgresHost , "postgres-host" , "" , "postgres host" )
44
- flag .Uint64Var (& f .Config . PostgresPort , "postgres-port" , 5432 , "postgres port" )
45
- flag .StringVar (& f .Config . DBName , "postgres-db" , "" , "postgres database" )
46
- flag .StringVar (& f .Config . PostgresUser , "postgres-user" , "" , "postgres username" )
47
- flag .StringVar (& f .Config . PostgresPassword , "postgres-password" , "" , "postgres password" )
48
- flag .StringVar (& f .Config . SSLMode , "ssl-mode" , "disable" , "postgres ssl mode[disable, require, verify-ca, verify-full]" )
43
+ flag .StringVar (& f .PostgresHost , "postgres-host" , "" , "postgres host" )
44
+ flag .Uint64Var (& f .PostgresPort , "postgres-port" , 5432 , "postgres port" )
45
+ flag .StringVar (& f .DBName , "postgres-db" , "" , "postgres database" )
46
+ flag .StringVar (& f .PostgresUser , "postgres-user" , "" , "postgres username" )
47
+ flag .StringVar (& f .PostgresPassword , "postgres-password" , "" , "postgres password" )
48
+ flag .StringVar (& f .SSLMode , "ssl-mode" , "disable" , "postgres ssl mode[disable, require, verify-ca, verify-full]" )
49
49
flag .IntVar (& sqlLogLevel , "sql-log-level" , 2 , "sql logger level" )
50
- flag .Uint64Var (& f .Config . MaxOpenConns , "max-open-conn" , 3 , "max open sql connections" )
51
- flag .Uint64Var (& f .Config . MaxIdleConns , "max-idle-conn" , 3 , "max idle sql connections" )
50
+ flag .Uint64Var (& f .MaxOpenConns , "max-open-conn" , 3 , "max open sql connections" )
51
+ flag .Uint64Var (& f .MaxIdleConns , "max-idle-conn" , 3 , "max idle sql connections" )
52
52
53
53
flag .BoolVar (& f .version , "v" , false , "shows the package version" )
54
54
flag .BoolVar (& f .debug , "debug" , false , "allow debug logs" )
@@ -58,7 +58,7 @@ func Run() error {
58
58
flag .Uint64Var (& f .adminTwinID , "admin-twin-id" , 1 , "admin twin ID" )
59
59
60
60
flag .Parse ()
61
- f .Config . SqlLogLevel = logger .LogLevel (sqlLogLevel )
61
+ f .SqlLogLevel = logger .LogLevel (sqlLogLevel )
62
62
63
63
if f .version {
64
64
log .Info ().Str ("version" , version ).Str ("commit" , commit ).Send ()
@@ -108,8 +108,8 @@ func (f flags) validate() error {
108
108
return errors .New ("invalid domain name, domain name should not be empty" )
109
109
}
110
110
111
- if f .Config . SqlLogLevel < 1 || f . Config .SqlLogLevel > 4 {
112
- return errors .Errorf ("invalid sql log level %d, sql log level should be in the range 1-4" , f .Config . SqlLogLevel )
111
+ if f .SqlLogLevel < 1 || f .SqlLogLevel > 4 {
112
+ return errors .Errorf ("invalid sql log level %d, sql log level should be in the range 1-4" , f .SqlLogLevel )
113
113
}
114
114
if f .adminTwinID == 0 {
115
115
return errors .Errorf ("invalid admin twin id %d, admin twin id should not be 0" , f .adminTwinID )
@@ -119,5 +119,5 @@ func (f flags) validate() error {
119
119
return errors .Wrapf (err , "invalid domain %s" , f .domain )
120
120
}
121
121
122
- return f .Config . Validate ()
122
+ return f .Validate ()
123
123
}
0 commit comments