Skip to content

Commit

Permalink
fix: add -password flag back
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Aug 13, 2022
1 parent a66b2d9 commit ba9d568
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions alist.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package main

import (
"fmt"

"github.com/Xhofe/alist/bootstrap"
"github.com/Xhofe/alist/conf"
_ "github.com/Xhofe/alist/drivers"
"github.com/Xhofe/alist/model"
"github.com/Xhofe/alist/server"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
Expand All @@ -14,6 +16,15 @@ func Init() bool {
bootstrap.InitConf()
bootstrap.InitCron()
bootstrap.InitModel()
if conf.Password {
pass, err := model.GetSettingByKey("password")
if err != nil {
log.Errorf(err.Error())
return false
}
fmt.Printf("your password: %s\n", pass.Value)
return false
}
server.InitIndex()
bootstrap.InitSettings()
bootstrap.InitAuth()
Expand Down
2 changes: 2 additions & 0 deletions bootstrap/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package bootstrap

import (
"flag"

"github.com/Xhofe/alist/conf"
log "github.com/sirupsen/logrus"
)
Expand Down Expand Up @@ -29,6 +30,7 @@ func init() {
flag.StringVar(&conf.ConfigFile, "conf", "data/config.json", "config file")
flag.BoolVar(&conf.Debug, "debug", false, "start with debug mode")
flag.BoolVar(&conf.Version, "version", false, "print version info")
flag.BoolVar(&conf.Password, "password", false, "print current password")
flag.BoolVar(&conf.Docker, "docker", false, "is using docker")
flag.Parse()
InitLog()
Expand Down

0 comments on commit ba9d568

Please sign in to comment.