https://github.com/s0rg/toggle-svc
https://github.com/s0rg/toggle-svc
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/s0rg/toggle-svc
- Owner: s0rg
- License: mit
- Created: 2020-09-28T10:58:29.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-18T12:53:53.000Z (almost 5 years ago)
- Last Synced: 2025-01-18T05:31:04.256Z (9 months ago)
- Language: Go
- Size: 19.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# toggle-svc
Feature-toggler MVP
It allows you to manage feature-toggles for your applications, and switch them on/off/or for some amount of clients.
# Set-up
- `git clone https://github.com/s0rg/toggle-svc.git`
- `cd toggle-svc`
- `make docker-build`
- `docker-compose up`# Data logic
## Redis keys
- `svc-toggle:clients:{segment-key}:count` - holds count of clients in each different segment
- `svc-toggle:clients:{state-key}:state` - hold state for each alive client (his segment-key and toggles).
- `svc-toggle:clients:{state-key}:alive` - alive flag for each client (with TTL)
- `svc-toggle:toggles:{segment-key}:{toggle-id}:count` - count of toggles by segment for each toggle-id# Usage
Create some apps, they acts as namespaces for your features.
`curl -d '{
"apps": ["ios", "web", "android"]
}' http://localhost:8080/apps/add`Add some keys for "web"-application, note the `key3` has been initially disabled.
`curl -d '{
"app": "web",
"version": "1.0",
"platforms": ["ie6"],
"keys": [
{"name": "key1", "enabled": true},
{"name": "key2", "enabled": true},
{"name": "key3", "enabled": false}
]}' http://localhost:8080/toggles/add`Edit key3 for web to cover only 50% cients.
`curl -d '{
"app": "web",
"version": "1.0",
"platform": "ie6",
"key": "key3",
"rate": 0.5
}' http://localhost:8080/toggles/edit`Get some toggles.
`curl -d '{
"app": "web",
"version": "1.0",
"platform": "ie6"
}' http://localhost:8080/client/code-toggles`Retrive toggles (without any counters increase).
`curl -H "X-CodeToggleID: your-toggle-id" -d '{
"app": "web",
"version": "1.0",
"platform": "ie6"
}' http://localhost:8080/client/code-toggles`Updates client alive ttl.
`curl -d '{"id": "your-toggle-id"}' http://localhost:8080/client/alive`