Exemple #1
0
func getStorageFromConfig(key string, jq *jsonq.JsonQuery) (gostorages.Storage, error) {
	storageType, err := jq.String("storage", key, "type")

	parameter, ok := Storages[storageType]

	if !ok {
		return nil, fmt.Errorf("Storage %s does not exist", key)
	}

	config, err := jq.Object("storage", key)

	if err != nil {
		return nil, err
	}

	storage, err := parameter(util.MapInterfaceToMapString(config))

	if err != nil {
		return nil, err
	}

	return storage, err
}
Exemple #2
0
var SentryInitializer Initializer = func(jq *jsonq.JsonQuery, app *Application) error {
	dsn, err := jq.String("sentry", "dsn")

	if err != nil {
		return nil
	}

	results, err := jq.Object("sentry", "tags")

	var tags map[string]string

	if err != nil {
		tags = map[string]string{}
	} else {
		tags = util.MapInterfaceToMapString(results)
	}

	client, err := raven.NewClient(dsn, tags)

	if err != nil {
		return err
	}

	app.Raven = client

	return nil
}

var BasicInitializer Initializer = func(jq *jsonq.JsonQuery, app *Application) error {
	var format string