Add start api command
This commit is contained in:
parent
372e92fc41
commit
199b3b1f7f
15
cmd/root.go
15
cmd/root.go
@ -28,6 +28,9 @@ type createArgs struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
gApiAddress string
|
||||||
|
gApiPort int
|
||||||
|
|
||||||
gJailHost JailHost
|
gJailHost JailHost
|
||||||
gJails []Jail
|
gJails []Jail
|
||||||
gDatastores []Datastore
|
gDatastores []Datastore
|
||||||
@ -362,6 +365,14 @@ You can specify multiple datastores.`,
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apiCmd = &cobra.Command{
|
||||||
|
Use: "startapi",
|
||||||
|
Short: "Run docage as a daemon, exposing API",
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
startApi(gApiAddress, gApiPort)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
testCmd = &cobra.Command{
|
testCmd = &cobra.Command{
|
||||||
Use: "test",
|
Use: "test",
|
||||||
Short: "temporary command to test some code snippet",
|
Short: "temporary command to test some code snippet",
|
||||||
@ -428,6 +439,9 @@ func init() {
|
|||||||
createCmd.Flags().BoolVarP(&gCreateArgs.BaseJail, "basejail", "b", false, "Basejail. This will create a jail mounted read only from a release, so every up(date|grade) made to this release will immediately propagate to new jail.\n")
|
createCmd.Flags().BoolVarP(&gCreateArgs.BaseJail, "basejail", "b", false, "Basejail. This will create a jail mounted read only from a release, so every up(date|grade) made to this release will immediately propagate to new jail.\n")
|
||||||
createCmd.Flags().StringVarP(&gCreateArgs.Datastore, "datastore", "d", "", "Datastore to create the jail on. Defaults to first declared in config.")
|
createCmd.Flags().StringVarP(&gCreateArgs.Datastore, "datastore", "d", "", "Datastore to create the jail on. Defaults to first declared in config.")
|
||||||
|
|
||||||
|
apiCmd.Flags().StringVarP(&gApiAddress, "listen-addr", "l", "127.0.0.1", "API listening address")
|
||||||
|
apiCmd.Flags().IntVarP(&gApiPort, "listen-port", "p", 1234, "API listening port")
|
||||||
|
|
||||||
// Now declare commands
|
// Now declare commands
|
||||||
rootCmd.AddCommand(versionCmd)
|
rootCmd.AddCommand(versionCmd)
|
||||||
rootCmd.AddCommand(listCmd)
|
rootCmd.AddCommand(listCmd)
|
||||||
@ -446,6 +460,7 @@ func init() {
|
|||||||
rootCmd.AddCommand(updateCmd)
|
rootCmd.AddCommand(updateCmd)
|
||||||
rootCmd.AddCommand(upgradeCmd)
|
rootCmd.AddCommand(upgradeCmd)
|
||||||
rootCmd.AddCommand(createCmd)
|
rootCmd.AddCommand(createCmd)
|
||||||
|
rootCmd.AddCommand(apiCmd)
|
||||||
|
|
||||||
rootCmd.AddCommand(testCmd)
|
rootCmd.AddCommand(testCmd)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user