Пример #1
0
func (s *Service) Configure(app *bedrock.Application) error {
	if err := s.airbrake.Configure(app); err != nil {
		return err
	}

	if err := s.newrelic.Configure(app); err != nil {
		return err
	}

	if err := s.dbsvc.Configure(app); err != nil {
		return err
	}

	if err := app.BindConfig(&s.config); err != nil {
		return err
	}

	return nil
}
Пример #2
0
import (
	"github.com/gin-gonic/gin"
	"github.com/johnny-lai/bedrock"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"log"
	"net/http"
	"net/http/httptest"
	"os"
	"testing"
)

var _ = Describe("Service", func() {
	var (
		app *bedrock.Application
		svc Service
	)

	BeforeEach(func() {
		gin.SetMode(gin.TestMode)

		file := os.Getenv("TEST_CONFIG_YML")
		if file == "" {
			log.Fatal("Configuration file not specified. Please set TEST_CONFIG_YML variable")
		}

		app = new(bedrock.Application)
		app.Engine = gin.New()

		err := app.ReadConfigFile(file)
		if err != nil {