|
This is legacy documentation
CloudBees Feature Management is now part of CloudBees Unify. For current feature management documentation, go to CloudBees Unify Feature management. This documentation covers the original CloudBees Feature Management product (formerly Rollout.io), which is end-of-life. It remains available only for existing customers who are migrating to CloudBees Unify. |
|
Support during the extension period
Because CloudBees Feature Management is an end-of-life product, support during the extension period is limited to critical items only:
This coverage is consistent with the CloudBees end-of-life policy in the support Terms & Conditions. |
This section describes how to set up and install the Go SDK and how to deploy a feature flag.
Step 1 - Setting up
To setup Go SDK, follow these steps:
-
Create a CloudBees Feature Management account. See Signup Page to create an account.
-
Get your environment key. Copy your environment key from App settings > Environments > Key.
Add the CloudBees Feature Management Go package to your application
To add the CloudBees Feature Management Go library to your project, run the following command:
# Add the SDK to your project $go get -u github.com/rollout/rox-go/v5/...
Add the following lines of code to your project
import ( "fmt" "github.com/rollout/rox-go/v5/server" ) // Create Roxflags in the Flags container class type Flags struct { EnableTutorial server.RoxFlag TitleColors server.RoxString Page server.RoxInt Percentage server.RoxDouble } var flags = & Flags { // Define the feature flags EnableTutorial: server.NewRoxFlag(false), TitleColors: server.NewRoxString("Green", []string{"White", "Blue", "Green", "Yellow"}), Page: server.NewRoxInt(1, []int{1, 2, 3}), Percentage: server.NewRoxDouble(99.9, []float64{10.5, 50.0, 99.9}), } var rox * server.Rox func main() { options := server.NewRoxOptions(server.RoxOptionsBuilder{DevModeKey: "<ROLLOUT_DEVMODEKEY>"}) rox := server.NewRox() // Register the flags container rox.Register("", flags) // Setup the environment key <-rox.Setup("<ROLLOUT-ENV-KEY>", options) // Boolean flag example if (flags.EnableTutorial.IsEnabled(nil)) { // TODO: Put your code here that needs to be gated } // String flag example fmt.Println("TitleColors is " + flags.TitleColors.GetValue(nil)) // Int flag example fmt.Printf("Page is %v", flags.Page.GetValue(nil)) // Double flag example fmt.Printf("Percentage is %v", flags.Percentage.GetValue(nil)) }
|
Container class registration and environment key setup
|