split gateway from uplink
Change-Id: I7504a630cb85539750e32780c1c2347742a9c9c4 Reviewed-on: https://review.gerrithub.io/430644 Reviewed-by: Kaloyan Raev <kaloyan@storj.io> Tested-by: Kaloyan Raev <kaloyan@storj.io>
This commit is contained in:
parent
99640225fd
commit
cd51787827
18
cmd/gateway/README.md
Normal file
18
cmd/gateway/README.md
Normal file
@ -0,0 +1,18 @@
|
||||
# Gateway
|
||||
|
||||
Documentation for developing and building the gateway service
|
||||
|
||||
Usage:
|
||||
|
||||
First make an identity:
|
||||
```
|
||||
go install storj.io/storj/cmd/gateway
|
||||
gateway setup
|
||||
```
|
||||
|
||||
The gateway shares the uplink config file.
|
||||
You can edit `~/.storj/uplink/config.yaml` to your liking. Then run it!
|
||||
|
||||
```
|
||||
gateway run
|
||||
```
|
13
cmd/gateway/main.go
Normal file
13
cmd/gateway/main.go
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright (C) 2018 Storj Labs, Inc.
|
||||
// See LICENSE for copying information.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"storj.io/storj/cmd/uplink/cmd"
|
||||
"storj.io/storj/pkg/process"
|
||||
)
|
||||
|
||||
func main() {
|
||||
process.Exec(cmd.GWCmd)
|
||||
}
|
@ -17,7 +17,7 @@ func init() {
|
||||
Use: "cat",
|
||||
Short: "Copies a Storj object to standard out",
|
||||
RunE: catMain,
|
||||
})
|
||||
}, CLICmd)
|
||||
}
|
||||
|
||||
// catMain is the function executed when catCmd is called
|
||||
|
@ -31,7 +31,7 @@ func init() {
|
||||
Use: "cp",
|
||||
Short: "Copies a local file or Storj object to another location locally or in Storj",
|
||||
RunE: copyMain,
|
||||
})
|
||||
}, CLICmd)
|
||||
progress = cpCmd.Flags().Bool("progress", true, "if true, show progress")
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ func init() {
|
||||
Use: "ls",
|
||||
Short: "List objects and prefixes or all buckets",
|
||||
RunE: list,
|
||||
})
|
||||
}, CLICmd)
|
||||
recursiveFlag = lsCmd.Flags().Bool("recursive", false, "if true, list recursively")
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ func init() {
|
||||
Use: "mb",
|
||||
Short: "Create a new bucket",
|
||||
RunE: makeBucket,
|
||||
})
|
||||
}, CLICmd)
|
||||
}
|
||||
|
||||
func makeBucket(cmd *cobra.Command, args []string) error {
|
||||
|
@ -17,7 +17,7 @@ func init() {
|
||||
Use: "put",
|
||||
Short: "Copies data from standard in to a Storj object",
|
||||
RunE: putMain,
|
||||
})
|
||||
}, CLICmd)
|
||||
}
|
||||
|
||||
// putMain is the function executed when putCmd is called
|
||||
|
@ -19,7 +19,7 @@ func init() {
|
||||
Use: "rb",
|
||||
Short: "Remove an empty bucket",
|
||||
RunE: deleteBucket,
|
||||
})
|
||||
}, CLICmd)
|
||||
}
|
||||
|
||||
func deleteBucket(cmd *cobra.Command, args []string) error {
|
||||
|
@ -17,7 +17,7 @@ func init() {
|
||||
Use: "rm",
|
||||
Short: "Delete an object",
|
||||
RunE: delete,
|
||||
})
|
||||
}, CLICmd)
|
||||
}
|
||||
|
||||
func delete(cmd *cobra.Command, args []string) error {
|
||||
|
@ -23,14 +23,20 @@ type Config struct {
|
||||
|
||||
var cfg Config
|
||||
|
||||
// RootCmd represents the base command when called without any subcommands
|
||||
var RootCmd = &cobra.Command{
|
||||
// CLICmd represents the base CLI command when called without any subcommands
|
||||
var CLICmd = &cobra.Command{
|
||||
Use: "uplink",
|
||||
Short: "The Storj client-side S3 gateway and CLI",
|
||||
Short: "The Storj client-side CLI",
|
||||
}
|
||||
|
||||
func addCmd(cmd *cobra.Command) *cobra.Command {
|
||||
RootCmd.AddCommand(cmd)
|
||||
// GWCmd represents the base gateway command when called without any subcommands
|
||||
var GWCmd = &cobra.Command{
|
||||
Use: "gateway",
|
||||
Short: "The Storj client-side S3 gateway",
|
||||
}
|
||||
|
||||
func addCmd(cmd *cobra.Command, root *cobra.Command) *cobra.Command {
|
||||
root.AddCommand(cmd)
|
||||
cfgstruct.Bind(cmd.Flags(), &cfg, cfgstruct.ConfDir(defaultConfDir))
|
||||
cmd.Flags().String("config", filepath.Join(defaultConfDir, "config.yaml"), "path to configuration")
|
||||
return cmd
|
||||
|
@ -17,7 +17,7 @@ var (
|
||||
Use: "run",
|
||||
Short: "Run the S3 gateway",
|
||||
RunE: cmdRun,
|
||||
})
|
||||
}, GWCmd)
|
||||
)
|
||||
|
||||
func cmdRun(cmd *cobra.Command, args []string) (err error) {
|
||||
|
@ -36,7 +36,8 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
RootCmd.AddCommand(setupCmd)
|
||||
CLICmd.AddCommand(setupCmd)
|
||||
GWCmd.AddCommand(setupCmd)
|
||||
cfgstruct.Bind(setupCmd.Flags(), &setupCfg, cfgstruct.ConfDir(defaultConfDir))
|
||||
}
|
||||
|
||||
|
@ -9,5 +9,5 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
process.Exec(cmd.RootCmd)
|
||||
process.Exec(cmd.CLICmd)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user