sftpgo-mirror/cmd/serve.go

43 lines
961 B
Go
Raw Normal View History

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