repositorypackage
0.0.0-20241103113421-5c362211cf2b
Repository: https://github.com/isaacdsc/featureflag.git
Documentation: pkg.go.dev
# README
Feature Flag
Simples feature flag/ feature toagle
Startup service
Set environment requirements using direnv
export SECRET_KEY=""
export SERVICE_CLIENT_AT=""
export SDK_CLIENT_AT=""
Start with docker project
docker run -p 3000:3000 isaacdsc/featureflag:v0.1
Install SDK
go get -u github.com/IsaacDSC/featureflag
Authentication
Get Auth SDK
#### Get auth SDK client
POST http://localhost:3000/auth
Authorization: <token>
Get Auth Service Client
#### Get auth Service client
POST http://localhost:3000/auth
Authorization: <token>
Configuration
Example 1
Como criar uma ff
###
PATCH http://localhost:3000/
Accept: application/json
Content-Type: application/json
{
"flag_name": "teste1",
"active": true
}
Example 2
Como criar uma ff com 50% ou seja 50% das chamadas serão ativas e 50% das chamadas serão desativadas
###
PATCH http://localhost:3000/
Accept: application/json
Content-Type: application/json
{
"flag_name": "teste1",
"active": true,
"strategy": {
"percent": 50
}
}
Example 3
Como criar uma ff com configurações utilizando sessions, onde somente quem estiver com a session receberá a feature flag como ligada
###
PATCH http://localhost:3000/
Accept: application/json
Content-Type: application/json
{
"flag_name": "teste3",
"active": true,
"strategy": {
"session_id": ["34eec623-c9f2-494e-bf66-57a85139fd69"]
}
}