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

55 lines
1.3 KiB
Go
Raw Normal View History

package cmd
import (
2020-06-20 14:30:46 +02:00
"os"
"github.com/spf13/cobra"
2021-06-26 07:31:41 +02:00
"github.com/drakkan/sftpgo/v2/service"
2021-07-11 15:26:51 +02:00
"github.com/drakkan/sftpgo/v2/util"
)
var (
2019-09-16 08:52:58 +02:00
serveCmd = &cobra.Command{
Use: "serve",
2021-09-18 10:50:17 +02:00
Short: "Start the SFTPGo service",
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{
2021-07-11 15:26:51 +02:00
ConfigDir: util.CleanDirInput(configDir),
ConfigFile: configFile,
LogFilePath: logFilePath,
LogMaxSize: logMaxSize,
LogMaxBackups: logMaxBackups,
LogMaxAge: logMaxAge,
LogCompress: logCompress,
LogVerbose: logVerbose,
LogUTCTime: logUTCTime,
LoadDataFrom: loadDataFrom,
LoadDataMode: loadDataMode,
LoadDataQuotaScan: loadDataQuotaScan,
LoadDataClean: loadDataClean,
Shutdown: make(chan bool),
2019-09-16 08:52:58 +02:00
}
if err := service.Start(disableAWSInstallationCode); err == nil {
2019-09-16 08:52:58 +02:00
service.Wait()
if service.Error == nil {
os.Exit(0)
}
2019-09-16 08:52:58 +02:00
}
2020-06-20 14:30:46 +02:00
os.Exit(1)
},
}
)
func init() {
rootCmd.AddCommand(serveCmd)
2019-09-16 08:52:58 +02:00
addServeFlags(serveCmd)
addAWSContainerFlags(serveCmd)
}