Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package app
import (
"fmt"
"path"
"regexp"
"runtime/debug"
"strings"

Expand All @@ -18,12 +19,15 @@ import (

type Option func(*App) error

var flogoImportPattern = regexp.MustCompile(`^(([^ ]*)[ ]+)?([^@:]*)@?([^:]*)?:?(.*)?$`) // extract import path even if there is an alias and/or a version

func New(config *Config, runner action.Runner, options ...Option) (*App, error) {

app := &App{stopOnError: true, name: config.Name, version: config.Version}

for _, anImport := range config.Imports {
registerImport(anImport)
matches := flogoImportPattern.FindStringSubmatch(anImport)
registerImport(matches[1] + matches[3] + matches[5]) // alias + module path + relative import path
}

properties := make(map[string]interface{}, len(config.Properties))
Expand Down
71 changes: 71 additions & 0 deletions examples/alt/engine/flogo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"name": "_APP_NAME_",
"type": "flogo:app",
"version": "0.0.1",
"description": "My flogo application description",
"appModel": "1.0.0",
"imports": [
"github.com/project-flogo/contrib@latest:/activity/log",
"github.com/project-flogo/contrib@latest:/trigger/rest",
"github.com/project-flogo/flow@latest"
],
"triggers": [
{
"id": "my_rest_trigger",
"type": "rest",
"settings": {
"port": "8888"
},
"handlers": [
{
"settings": {
"method": "GET",
"path": "/test/:val"
},
"actions": [
{
"type": "flow",
"settings": {
"flowURI": "res://flow:simple_flow"
},
"input": {
"in": "=$.pathParams.val"
}
}
]
}
]
}
],
"resources": [
{
"id": "flow:simple_flow",
"data": {
"name": "simple_flow",
"metadata": {
"input": [
{ "name": "in", "type": "string", "value": "test" }
],
"output": [
{ "name": "out", "type": "string" }
]
},
"tasks": [
{
"id": "log",
"name": "Log Message",
"activity": {
"type": "log",
"input": {
"message": "=$flow.in",
"flowInfo": "false",
"addToFlow": "false"
}
}
}
],
"links": []
}
}
]
}