Files
opencloud/tests/ociswrapper/cmd/cmd.go
Sawjan Gurung 9945dad647 [POC][full-ci] Testing various oCIS env configurations (#6062)
* run api tests

* run ocis via wrapper

* add context, helpers and steps change ocis config

* remove separate pipelines for special test cases

* add context to behat config

* fix suite name

* set wrapper url while running tests

* fix cors allow env name

* address review

* add ociswrapper codebase

* add ci pipeline to build and cache wrapper

* add step to check ociswrapper cache

* invalidate wrapper cache and build new

* build on pipeline step

* undo unnecessary changes

* undo unnecessary changes

* fix php code

* fix ocis run command

* use tag for teardown

* exclude wrapper vendor in codacy check

* fix typos
2023-05-11 17:21:52 +05:45

52 lines
1.2 KiB
Go

package cmd
import (
"ociswrapper/common"
ocis "ociswrapper/ocis"
ocisConfig "ociswrapper/ocis/config"
wrapper "ociswrapper/wrapper"
wrapperConfig "ociswrapper/wrapper/config"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "ociswrapper",
Short: "ociswrapper is a wrapper for oCIS server",
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
},
}
func serveCmd() *cobra.Command {
serveCmd := &cobra.Command{
Use: "serve",
Short: "Starts the server",
Run: func(cmd *cobra.Command, args []string) {
common.Wg.Add(2)
go ocis.Start(nil)
go wrapper.Start(cmd.Flag("port").Value.String())
// set configs
ocisConfig.Set("bin", cmd.Flag("bin").Value.String())
ocisConfig.Set("url", cmd.Flag("url").Value.String())
},
}
// serve command args
serveCmd.Flags().SortFlags = false
serveCmd.Flags().StringP("bin", "", ocisConfig.Get("bin"), "Full oCIS binary path")
serveCmd.Flags().StringP("url", "", ocisConfig.Get("url"), "oCIS server url")
serveCmd.Flags().StringP("port", "p", wrapperConfig.Get("port"), "Wrapper API server port")
return serveCmd
}
func Execute() {
rootCmd.CompletionOptions.DisableDefaultCmd = true
rootCmd.AddCommand(serveCmd())
rootCmd.Execute()
}