Skip to content

prefab-cloud/prefab-cloud-go

Folders and files

NameName
Last commit message
Last commit date
Oct 14, 2024
Feb 27, 2025
Feb 27, 2025
Feb 27, 2025
Feb 27, 2025
Dec 4, 2024
Feb 20, 2024
Jun 25, 2024
Aug 12, 2024
Feb 20, 2024
Jun 25, 2024
Oct 15, 2024
Feb 27, 2025
Feb 27, 2025
Aug 12, 2024

Repository files navigation

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