The fabric8-toggles-service is the client service to run with the fabric8-toggles server. The server is heavily based on Unleash server, a feature toggle system, that gives you a great overview over all feature toggles across all your applications and services. It comes with official client implementations for Java, Node.js and Go.
fabric8-server defines 4 level of toggle configuration: internal
, experimental
, beta
or released
.
The activation strategy is per userGroupId.
Using the admin console deployed with fabric8-toggle, you can easily
move a feature from experimental
to beta
.
This client makes use of the unleash Go SDK to connect to fabric8-toggles server.
You can see usage of the service in fabric8-ui.
The following guide is mainly targeted towards a Linux or macOS development machine.
Have the following installed on your machine:
go
Install GoLang from 1.8+, set the environment variable GOPATH
.
$ git clone https://github.com/fabric8-services/fabric8-toggles-services $GOPATH/src/github.com/fabric8-services/fabric8-toggles-service
To fetch the Go dependencies, generate code (GOA framework) and finally build the project you can type:
$ cd $GOPATH/src/github.com/fabric8-services/fabric8-toggles-service
$ make clean build
-
build image from centos
make image
-
run your docker image in minishift
make deploy-minishift
-
Deploy locally:
F8_TOGGLES_URL=http://toggles-fabric8.192.168.64.4.xip.io/api F8_AUTH_URL=https://auth.prod-preview.openshift.io make run
where F8_TOGGLES_URL
points to the exposed route on minishift and F8_AUTH_URL
target prod-preview.
-
Go to fabric8-toggles-server admin console (ie: the unleash admin console) http://fabric8-toggles-fabric8.MINISHIFT_IP.nip.io
-
In strategy tab:
-
add a strategy with name
enableByLevel
with a parameterlevel
, choosestring
for parameter type. -
add a strategy with name
enableByEmails
with a parameteremails
, chooselist
for parameter type.
-
-
Go to features list:
-
add a feature with name "Planner", give a description and add the newly created
enableByLevel
strategy, enterreleased
. -
add a feature with name
Analyze
, give a description and add the newly createdenableByEmails
strategy, enter your prod-preview and prod emails. forlevel
. Enable the feature.
-
📎
|
This is a temporary settings, the fabric8-server should bootstrap those values. |
-
For anonymous user
$ curl http://localhost:8080/api/features?names\=Planner
{
"data": [
{
"attributes": {
"description": "Planner's description",
"enabled": true,
"enablement-level": "released",
"user-enabled": true
},
"id": "Planner",
"type": "features"
}
]
}
-
For logged-in user
$ export TOKEN=YOUT_TOKEN
$ curl http://localhost:8080/api/features\?group\=Analyze -H "Authorization: Bearer $TOKEN"