@ -704,6 +704,7 @@ func parseInvokeConfig(invoke string) (cfg invokeConfig, err error) {
}
}
csvReader := csv . NewReader ( strings . NewReader ( invoke ) )
csvReader := csv . NewReader ( strings . NewReader ( invoke ) )
csvReader . LazyQuotes = true
fields , err := csvReader . Read ( )
fields , err := csvReader . Read ( )
if err != nil {
if err != nil {
return cfg , err
return cfg , err
@ -723,14 +724,14 @@ func parseInvokeConfig(invoke string) (cfg invokeConfig, err error) {
value := parts [ 1 ]
value := parts [ 1 ]
switch key {
switch key {
case "args" :
case "args" :
cfg . Cmd = append ( cfg . Cmd , value ) // TODO: support JSON
cfg . Cmd = append ( cfg . Cmd , maybeJSONArray ( value ) ... )
case "entrypoint" :
case "entrypoint" :
cfg . Entrypoint = append ( cfg . Entrypoint , value ) // TODO: support JSON
cfg . Entrypoint = append ( cfg . Entrypoint , maybeJSONArray ( value ) ... )
if cfg . Cmd == nil {
if cfg . Cmd == nil {
cfg . Cmd = [ ] string { }
cfg . Cmd = [ ] string { }
}
}
case "env" :
case "env" :
cfg . Env = append ( cfg . Env , value )
cfg . Env = append ( cfg . Env , maybeJSONArray ( value ) ... )
case "user" :
case "user" :
cfg . User = value
cfg . User = value
cfg . NoUser = false
cfg . NoUser = false
@ -749,6 +750,14 @@ func parseInvokeConfig(invoke string) (cfg invokeConfig, err error) {
return cfg , nil
return cfg , nil
}
}
func maybeJSONArray ( v string ) [ ] string {
var list [ ] string
if err := json . Unmarshal ( [ ] byte ( v ) , & list ) ; err == nil {
return list
}
return [ ] string { v }
}
func listToMap ( values [ ] string , defaultEnv bool ) map [ string ] string {
func listToMap ( values [ ] string , defaultEnv bool ) map [ string ] string {
result := make ( map [ string ] string , len ( values ) )
result := make ( map [ string ] string , len ( values ) )
for _ , value := range values {
for _ , value := range values {