mirror of
https://github.com/moul/sshportal.git
synced 2025-01-11 01:47:46 +08:00
add log directory creation if it does not exist.
This commit is contained in:
parent
0295eedb6e
commit
da9c4920ab
1 changed files with 13 additions and 0 deletions
13
main.go
13
main.go
|
@ -135,6 +135,19 @@ func server(c *cli.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// check for the logdir existence
|
||||
logsLocation, e := os.Stat(c.String("logs-location"))
|
||||
if e != nil {
|
||||
err = os.MkdirAll(c.String("logs-location"), os.ModeDir | os.FileMode(0750) )
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if !logsLocation.IsDir() {
|
||||
log.Fatal("log directory cannnot be created")
|
||||
}
|
||||
}
|
||||
|
||||
opts := []ssh.Option{}
|
||||
// custom PublicKeyAuth handler
|
||||
opts = append(opts, ssh.PublicKeyAuth(publicKeyAuthHandler(db, c)))
|
||||
|
|
Loading…
Reference in a new issue