Skip to content

RafaelPiloto10/treblle-go-fiber

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

treblle-go-fiber

The offical Trebble SDK for Go using Fiber

Get Started

  1. Sign in to Treblle.
  2. Create a Treblle project.

Install the Go-Fiber SDK

go get github.com/RafaelPiloto10/treblle-go-fiber/trebble_fiber@latest

Basic configuration

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

package main

import (
	treblle_fiber "github.com/RafaelPiloto10/treblle-go-fiber/trebble_fiber"
)

func main() {
	treblle_fiber.Configure(treblle_fiber.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
		IgnorePrefix: []string{"/pi"}, // optional, ignore routes that start with these prefixes
		IgnoreExact: []string{"/ping"}, // optional, ignore routes that match exactly
	}

    // rest of your program.
}

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

app := fiber.New(fiber.Config{})
app.Use(treblle_fiber.Middleware())
app.Listen("localhost:3000")

See the docs to learn more.