Categorygithub.com/prefab-cloud/prefab-cloud-go
repository
0.0.6
Repository: https://github.com/prefab-cloud/prefab-cloud-go.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# README

prefab-cloud-go

Go Client for Prefab Feature Flags, Dynamic log levels, and Config as a Service: https://www.prefab.cloud

Installation

go get github.com/prefab-cloud/prefab-cloud-go@latest

Basic example

package main

import (
	"fmt"
	"log"
	"os"

	prefab "github.com/prefab-cloud/prefab-cloud-go/pkg"
)

func main() {
	apiKey, exists := os.LookupEnv("PREFAB_API_KEY")

	if !exists {
		log.Fatal("API Key not found")
	}

	client, err := prefab.NewClient(prefab.WithAPIKey(apiKey))

	if err != nil {
		log.Fatal(err)
	}

	val, ok, err := client.GetStringValue("my.string.config", prefab.ContextSet{})

	if err != nil {
		log.Fatal(err)
	}

	if !ok {
		log.Fatal("Value not found")
	}

	fmt.Println(val)
}

Documentation

Notable pending features

  • Telemetry
  • JSON dump data source