You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.go 1.2 kB

1 year ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package main
  2. import (
  3. "flag"
  4. "fmt"
  5. "os"
  6. "github.com/spf13/cobra"
  7. "github.com/wunderio/csi-rclone/pkg/rclone"
  8. )
  9. var (
  10. endpoint string
  11. nodeID string
  12. )
  13. func init() {
  14. flag.Set("logtostderr", "true")
  15. }
  16. func main() {
  17. flag.CommandLine.Parse([]string{})
  18. cmd := &cobra.Command{
  19. Use: "rclone",
  20. Short: "CSI based rclone driver",
  21. Run: func(cmd *cobra.Command, args []string) {
  22. handle()
  23. },
  24. }
  25. cmd.Flags().AddGoFlagSet(flag.CommandLine)
  26. cmd.PersistentFlags().StringVar(&nodeID, "nodeid", "", "node id")
  27. cmd.MarkPersistentFlagRequired("nodeid")
  28. cmd.PersistentFlags().StringVar(&endpoint, "endpoint", "", "CSI endpoint")
  29. cmd.MarkPersistentFlagRequired("endpoint")
  30. versionCmd := &cobra.Command{
  31. Use: "version",
  32. Short: "Prints information about this version of csi rclone plugin",
  33. Run: func(cmd *cobra.Command, args []string) {
  34. fmt.Printf(`csi-rclone plugin
  35. Version: %s
  36. `, rclone.DriverVersion)
  37. },
  38. }
  39. cmd.AddCommand(versionCmd)
  40. versionCmd.ResetFlags()
  41. cmd.ParseFlags(os.Args[1:])
  42. if err := cmd.Execute(); err != nil {
  43. fmt.Fprintf(os.Stderr, "%s", err.Error())
  44. os.Exit(1)
  45. }
  46. os.Exit(0)
  47. }
  48. func handle() {
  49. d := rclone.NewDriver(nodeID, endpoint)
  50. d.Run()
  51. }

本项目旨在将云际存储公共基础设施化,使个人及企业可低门槛使用高效的云际存储服务(安装开箱即用云际存储客户端即可,无需关注其他组件的部署),同时支持用户灵活便捷定制云际存储的功能细节。