Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aelse/ffs
An example of how to create a feature flag service
https://github.com/aelse/ffs
Last synced: 2 days ago
JSON representation
An example of how to create a feature flag service
- Host: GitHub
- URL: https://github.com/aelse/ffs
- Owner: aelse
- License: mit
- Created: 2018-09-10T12:12:35.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-09-10T12:14:58.000Z (about 6 years ago)
- Last Synced: 2024-06-20T16:50:28.065Z (5 months ago)
- Language: Go
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Feature Flag Service
`ffs` is a simple implementation of a feature flag service.
A feature flag service enables software to make decisions at runtime about how
to operate. This can be used as a way to deploy "dark features" and later
activate them for some or all traffic. You might want to do this to decouple
deployment and release of new code, to perform canary releases or as a way
to do A/B testing.# Parts
This repo includes the ffs:
* server, holds the authoritative view of feature flags and serves flags
* client library, which synchronises application flag state with server
* cli tool, for performing flag admin tasks on the server
* demo service, which is our service we want to deploy with dark features# How to use
Run the feature flag server.
go run github.com/aelse/ffs/server
Run the demo service.
go run github.com/aelse/ffs/demo
You can now access the demo at [http://localhost:8081](http://localhost:8081)
in your web browser.Using curl you can modify the feature flags by POSTing to the feature flag
server listening on port 8080.curl -i -X POST http://localhost:8080/flags -H "Content-Type: application/json" -d '{ "name": "myflag", "value": true }'
Reload the browser page to see the new flag value.
# How it works
The feature flag server keeps a representation of all feature flags in memory.
The client also keeps a representation in memory.
Clients connect over websocket and receive the list of all current flag names
and values. When you POST to the `/flags` endpoint the added or modified flag
is sent to all connected clients. In this way clients always have an up to date
view of all feature flags.In the application code making use of feature flags, the client provides an
api for the application code to check the value it should use for a flag.
The application asks the client "what do I do for flag X?" and then acts
accordingly.