1
0
mirror of https://github.com/drakkan/sftpgo.git synced 2025-11-23 22:04:50 +02:00
Files
sftpgo/cmd/serve.go

42 lines
960 B
Go
Raw Normal View History

package cmd
import (
2019-09-16 08:52:58 +02:00
"github.com/drakkan/sftpgo/service"
"github.com/drakkan/sftpgo/utils"
"github.com/spf13/cobra"
)
var (
2019-09-16 08:52:58 +02:00
serveCmd = &cobra.Command{
Use: "serve",
Short: "Start the SFTP Server",
2019-09-16 08:52:58 +02:00
Long: `To start the SFTPGo with the default values for the command line flags simply use:
sftpgo serve
2019-09-16 08:52:58 +02:00
Please take a look at the usage below to customize the startup options`,
Run: func(cmd *cobra.Command, args []string) {
2019-09-16 08:52:58 +02:00
service := service.Service{
ConfigDir: utils.CleanDirInput(configDir),
2019-09-16 08:52:58 +02:00
ConfigFile: configFile,
LogFilePath: logFilePath,
LogMaxSize: logMaxSize,
LogMaxBackups: logMaxBackups,
LogMaxAge: logMaxAge,
LogCompress: logCompress,
LogVerbose: logVerbose,
Profiler: profiler,
2019-09-16 08:52:58 +02:00
Shutdown: make(chan bool),
}
if err := service.Start(); err == nil {
service.Wait()
}
},
}
)
func init() {
rootCmd.AddCommand(serveCmd)
2019-09-16 08:52:58 +02:00
addServeFlags(serveCmd)
}