Skip to content

Commit a190780

Browse files
author
Mehrad
committed
support debug mode @ app.create()
1 parent 17a1a51 commit a190780

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

cmd/application.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ var (
1414
minScale uint64
1515
flagVarImage string
1616
flagVarEndpointType string
17+
flagVarDebug bool
1718
)
1819

1920
func appList(cmd *cobra.Command, args []string) {
@@ -101,7 +102,7 @@ func appDestroy(cmd *cobra.Command, args []string) {
101102
}
102103

103104
// ApplicationCreate create application by link of docker image
104-
func ApplicationCreate(appName, image, plan, EndpointType string, port, minScale uint64) (*ybApi.AppStatusRes, error) {
105+
func ApplicationCreate(appName, image, plan, EndpointType string, port, minScale uint64, debugMode bool) (*ybApi.AppStatusRes, error) {
105106
if err := endpointTypeValid(EndpointType); err != nil {
106107
log.Panic(err)
107108
}
@@ -112,6 +113,7 @@ func ApplicationCreate(appName, image, plan, EndpointType string, port, minScale
112113
req.Values["ports"] = fmt.Sprintf("%d/%s", port, EndpointType)
113114
req.Values["minimum-scale"] = fmt.Sprintf("%d", minScale)
114115
req.Values["image"] = image
116+
req.Values["debug"] = fmt.Sprintf("%b", debugMode)
115117

116118
client := grpcConnect()
117119
defer client.Close()
@@ -125,7 +127,8 @@ func appCreate(cmd *cobra.Command, args []string) {
125127
cmd.Flag("plan").Value.String(),
126128
flagVarEndpointType,
127129
flagVarPort,
128-
flagVarMinScale)
130+
flagVarMinScale,
131+
flagVarDebug)
129132
uiCheckErr("Could not Create the Application", err)
130133
uiApplicationStatus(res)
131134
}

cmd/command_create_update.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var (
3030
--image="hub.yottab.io/test/myworker:v1.2.3" \
3131
--name="myaspnetapp" \
3232
--min-scale=4 \
33+
--debug=true \
3334
--port=8080 \
3435
--endpoint-type=private`}
3536

@@ -112,6 +113,7 @@ func init() {
112113
appCreateCmd.Flags().StringVarP(&flagVarImage, "image", "i", "", "image of application")
113114
appCreateCmd.Flags().StringVarP(&flagVarEndpointType, "endpoint-type", "e", "http", "Accepted values: http|grpc|private")
114115
appCreateCmd.Flags().Uint64VarP(&flagVarMinScale, "min-scale", "m", 1, "min scale of application")
116+
appCreateCmd.Flags().BoolVarP(&flagVarDebug, "debug", "d", false, "Debug mode; To configure the restart policy for the Application and do not automatically restart.")
115117
appCreateCmd.MarkFlagRequired("name")
116118
appCreateCmd.MarkFlagRequired("image")
117119

0 commit comments

Comments
 (0)