コード例 #1
0
ファイル: app.go プロジェクト: Hearst-DD/gapp
func (a *app) LoadConfig() gappconfig.Config {
	config = gappconfig.New("MYAPP_", gappconfig.Map{
		{"ENV", "dev"},
		{"PRETTY", true},
		{"HOST", "localhost"},
		{"PORT", 4001},
	})
	return config
}
コード例 #2
0
ファイル: app_test.go プロジェクト: Hearst-DD/gapp
package gapp

import (
	"net/http"
	"testing"
	"time"

	"github.com/Hearst-DD/gappconfig"
	"github.com/codegangsta/negroni"
	"github.com/gorilla/mux"
	"github.com/stretchr/testify/assert"
)

var conf = gappconfig.New("FOO_", gappconfig.Map{
	{"BAR", "baz"},
})

var handlers = []negroni.Handler{
	RecoveryMiddleware(func(rw http.ResponseWriter, r *http.Request) {}),
}

// used for asserting order of API methods called
var state = "start"

type testapp struct {
	t *testing.T
}

func (a *testapp) LoadConfig() gappconfig.Config {
	assert.Equal(a.t, "start", state)
	state = "LoadConfigCalled"