mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
Add filesystem factory functions and add related cli options
This commit is contained in:
34
main.go
34
main.go
@@ -42,6 +42,7 @@ var commands = []cli.Command{
|
||||
|
||||
var modeCommands = []cli.Command{
|
||||
memoryCmd,
|
||||
fsCmd,
|
||||
donutCmd,
|
||||
}
|
||||
|
||||
@@ -70,6 +71,23 @@ EXAMPLES:
|
||||
`,
|
||||
}
|
||||
|
||||
var fsCmd = cli.Command{
|
||||
Name: "fs",
|
||||
Description: "Specify a path to instantiate filesystem driver",
|
||||
Action: runFilesystem,
|
||||
CustomHelpTemplate: `NAME:
|
||||
minio mode {{.Name}} - {{.Description}}
|
||||
|
||||
USAGE:
|
||||
minio mode {{.Name}} limit SIZE expire TIME
|
||||
|
||||
EXAMPLES:
|
||||
1. Export an existing filesystem path
|
||||
$ minio mode {{.Name}} /var/www
|
||||
|
||||
`,
|
||||
}
|
||||
|
||||
var donutCmd = cli.Command{
|
||||
Name: "donut",
|
||||
Description: "Specify a path to instantiate donut",
|
||||
@@ -204,7 +222,6 @@ func runDonut(c *cli.Context) {
|
||||
if len(c.Args()) < 1 {
|
||||
cli.ShowCommandHelpAndExit(c, "donut", 1) // last argument is exit code
|
||||
}
|
||||
|
||||
// supporting multiple paths
|
||||
var paths []string
|
||||
if strings.TrimSpace(c.Args().First()) == "" {
|
||||
@@ -226,6 +243,21 @@ func runDonut(c *cli.Context) {
|
||||
server.StartMinio(servers)
|
||||
}
|
||||
|
||||
func runFilesystem(c *cli.Context) {
|
||||
if len(c.Args()) != 1 {
|
||||
cli.ShowCommandHelpAndExit(c, "fs", 1) // last argument is exit code
|
||||
}
|
||||
apiServerConfig := getAPIServerConfig(c)
|
||||
fsDriver := server.FilesystemFactory{
|
||||
Config: apiServerConfig,
|
||||
Path: c.Args()[0],
|
||||
}
|
||||
apiServer := fsDriver.GetStartServerFunc()
|
||||
webServer := getWebServerConfigFunc(c)
|
||||
servers := []server.StartServerFunc{apiServer, webServer}
|
||||
server.StartMinio(servers)
|
||||
}
|
||||
|
||||
func getAPIServerConfig(c *cli.Context) httpserver.Config {
|
||||
certFile := c.String("cert")
|
||||
keyFile := c.String("key")
|
||||
|
||||
Reference in New Issue
Block a user