Skip to content

webtor-io/common-services

Repository files navigation

common-services

Collection of commonly used services at webtor.io

Probe

Generates standard liveness and readiness probe endpoints for kubernetes

Serve

Runs simultaneously multiple services in goroutines

Example usage

package main

import (
	cs "github.com/webtor-io/common-services"
	log "github.com/sirupsen/logrus"
	"github.com/urfave/cli"
	s "github.com/webtor-io/torrent-http-proxy/services"
)

func configure(app *cli.App) {
	app.Flags = []cli.Flag{}

	s.RegisterWebFlags(app)
	cs.RegisterProbeFlags(app)

	app.Action = run
}

func run(c *cli.Context) error {
	// Setting ProbeService
	probe := cs.NewProbe(c)
	defer probe.Close()

	// Setting WebService
	web := s.NewWeb(c)
	defer web.Close()

	// Setting ServeService
	serve := cs.NewServe(probe, web)

	// And SERVE!
	err := serve.Serve()
	if err != nil {
		log.WithError(err).Error("Got serve error")
	}
	return err
}

About

Collection of commonly used services at webtor.io

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages