Files
fn-serverless/main.go
Travis Reeder 1c8d12b09e Cleanup main (#470)
* main: clean up

* server: replace magical constants and use them for app name tracking
2017-01-03 14:59:26 -08:00

33 lines
733 B
Go

package main
import (
"context"
"os"
log "github.com/Sirupsen/logrus"
"github.com/iron-io/functions/api/datastore"
"github.com/iron-io/functions/api/mqs"
"github.com/iron-io/functions/api/server"
"github.com/spf13/viper"
)
func main() {
ctx := contextWithSignal(context.Background(), os.Interrupt)
ds, err := datastore.New(viper.GetString(server.EnvDBURL))
if err != nil {
log.WithError(err).Fatalln("Invalid DB url.")
}
mq, err := mqs.New(viper.GetString(server.EnvMQURL))
if err != nil {
log.WithError(err).Fatal("Error on init MQ")
}
apiURL := viper.GetString(server.EnvAPIURL)
funcServer := server.New(ctx, ds, mq, apiURL)
// Setup your custom extensions, listeners, etc here
funcServer.Start(ctx)
}