main.go 1.3 KB
Newer Older
Y
yaron2 已提交
1 2 3 4 5 6 7 8
package main

import (
	"flag"
	"os"
	"os/signal"
	"strconv"

9
	log "github.com/Sirupsen/logrus"
Y
yaron2 已提交
10
	"github.com/actionscore/actions/pkg/action"
11
	"github.com/actionscore/actions/pkg/version"
Y
yaron2 已提交
12 13 14
)

func main() {
15 16
	log.Infof("Starting Actions Runtime -- version %s -- commit %s", version.Version(), version.Commit())

Y
yaron2 已提交
17 18 19 20 21 22 23 24 25
	mode := flag.String("mode", "standalone", "")
	actionHTTPPort := flag.String("action-http-port", "3500", "")
	actionGRPCPort := flag.String("action-grpc-port", "50001", "")
	appPort := flag.String("app-port", "", "")
	appProtocol := flag.String("protocol", "http", "")
	eventSourcesPath := flag.String("event-sources-path", "./eventsources", "")
	configurationName := flag.String("configuration-name", "", "")
	actionID := flag.String("action-id", "", "")
	apiAddress := flag.String("api-address", "", "")
26
	placementServiceAddresss := flag.String("placement-address", "", "")
Y
yaron2 已提交
27 28 29 30 31 32 33 34 35 36
	allowedOrigins := flag.String("allowed-origins", "*", "")

	flag.Parse()

	stop := make(chan os.Signal, 1)
	signal.Notify(stop, os.Interrupt)

	actionHTTP, _ := strconv.Atoi(*actionHTTPPort)
	actionGRPC, _ := strconv.Atoi(*actionGRPCPort)

37
	i := action.NewAction(*actionID, *appPort, *mode, *appProtocol, *eventSourcesPath, *configurationName, *apiAddress, *placementServiceAddresss, *allowedOrigins)
Y
yaron2 已提交
38 39 40 41
	i.Run(actionHTTP, actionGRPC)

	<-stop
}