43 lines
867 B
Go
43 lines
867 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
"os"
|
|
"os/signal"
|
|
"strings"
|
|
"syscall"
|
|
"time"
|
|
|
|
"evobgp/internal/config"
|
|
"evobgp/internal/deploy"
|
|
"evobgp/internal/httpapi"
|
|
)
|
|
|
|
func main() {
|
|
cfg := config.Load()
|
|
name := cfg.ServiceName
|
|
if name == "" {
|
|
name = "evobgp-deploy"
|
|
}
|
|
log.Printf("%s starting (reference profile worker)", name)
|
|
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
|
defer stop()
|
|
|
|
bctx, bcancel := context.WithTimeout(context.Background(), 90*time.Second)
|
|
defer bcancel()
|
|
opts := httpapi.Options{
|
|
DatabaseURL: strings.TrimSpace(os.Getenv("EVOBGP_DATABASE_URL")),
|
|
SeedDemo: os.Getenv("EVOBGP_SEED_DEMO") != "0",
|
|
}
|
|
st, _, pool, err := httpapi.BootstrapWorkers(bctx, opts)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
if pool != nil {
|
|
defer pool.Close()
|
|
}
|
|
|
|
deploy.Run(ctx, &deploy.Deps{Store: st})
|
|
}
|