Skip to content

Latest commit

 

History

History
41 lines (26 loc) · 857 Bytes

README.md

File metadata and controls

41 lines (26 loc) · 857 Bytes

treblle-go-gin

The offical Treblle SDK for Go using Gin

Installation

go get github.com/treblle/treblle-go-gin

Trebble uses Go Modules to manage dependencies.

Basic configuration

Configure Treblle at the start of your main() function:

import "github.com/treblle/treblle-go"

func main() {
	treblle.Configure(treblle.Configuration{
		APIKey:     "YOUR API KEY HERE",
		ProjectID:  "YOUR PROJECT ID HERE",
		KeysToMask: []string{"password", "card_number"}, // optional, mask fields you don't want sent to Treblle
		ServerURL:  "https://rocknrolla.treblle.com",    // optional, don't use default server URL
	}

    // rest of your program.
}

After that, just use the middleware with any of your Gin handlers:

r := gin.Default()
r.Use(treblle.GinMiddleware())