增加使用命令初始化用户密码功能

This commit is contained in:
dushixiang
2021-03-05 20:02:17 +08:00
parent d16295baa5
commit af74e18c9a
3 changed files with 59 additions and 6 deletions

View File

@ -8,10 +8,11 @@ import (
)
type Config struct {
DB string
Server *Server
Mysql *Mysql
Sqlite *Sqlite
DB string
Server *Server
Mysql *Mysql
Sqlite *Sqlite
ResetPassword string
}
type Mysql struct {
@ -53,6 +54,7 @@ func SetupConfig() (*Config, error) {
pflag.String("server.addr", "", "server listen addr")
pflag.String("server.cert", "", "tls cert file")
pflag.String("server.key", "", "tls key file")
pflag.String("reset-password", "", "")
pflag.Parse()
_ = viper.BindPFlags(pflag.CommandLine)
@ -75,6 +77,7 @@ func SetupConfig() (*Config, error) {
Cert: viper.GetString("server.cert"),
Key: viper.GetString("server.key"),
},
ResetPassword: viper.GetString("reset-password"),
}
return config, nil