Flag/feature toggle service, written in aiohttp.
Method | Endpoint | Description |
---|---|---|
GET |
/api/docs |
Api documentation |
GET |
/api/v1/switch |
List of flags for the group. |
GET |
/api/v1/switches/{id}/svg-badge |
SVG badge with actual flag information |
GET |
/api/v1/switches_full_info |
List of all active flags with full info. |
Endpoint | Description |
---|---|
/zbs/login |
Login form |
/zbs/switches |
List of flags |
/zbs/switches/{switch_id} |
Flag detail |
{
"count": 2,
"result": ["test_flag3", "test_flag4"]
}
SVG badges can be useful for showing actual feature flag states.
Open Flag detail
page, find SVG badge
section and copy badge.
You will get an image with a link in Markdown format:
[![flag-name](link-to-svg-badge)](link-to-flag-editing-page)
Then paste text in a text editor with Markdown support (task tracker, Slack, Mattermost etc.). Actual flag state will be displayed as follows:
State | Badge |
---|---|
Active flag | |
Inactive flag | |
Deleted flag | |
Unknown flag |
See settings.yaml for additional settings.
Environment notice helps to visually distinguish environments (e.g. development, staging, production).
To add the environment notice to every page in the admin, add following settings:
export DYNACONF_ENVIRONMENT_NOTICE__show=true # false by default
export DYNACONF_ENVIRONMENT_NOTICE__environment_name='<Environment>'
export DYNACONF_ENVIRONMENT_NOTICE__background_color='<HEX color>'
See settings.yaml for default settings for each specified environment.
its_on
requires an SQL database and a cache storage engine.
Currently, only PostgreSQL and Redis are supported as respective backends.
Clone repo:
$ git clone git@gitlab.com:bestdoctor/public/its_on.git
Install python packages:
$ pip install -r requirements.txt
Specify database and cache settings:
export DYNACONF_REDIS_URL=redis://127.0.0.1:6379/1
export DYNACONF_CACHE_URL=redis://127.0.0.1:6379/1
export DYNACONF_DATABASE__dsn=postgresql://user:password@127.0.0.1:5432/its_on
Apply database migrations:
$ alembic upgrade head
Create admin user:
$ python scripts/create_user.py --login=admin --password=password --is_superuser
Run server:
$ python -m its_on
Navigate to http://127.0.0.1:8081/api/docs
in your browser
and you are good to go!
Example docker-compose.yml
file:
version: '3'
services:
cache:
image: redis
container_name: its-on-redis
db:
image: postgres
container_name: its-on-postgres
environment:
POSTGRES_PASSWORD: strongpassword
POSTGRES_USER: itson
POSTGRES_DB: itson
web:
image: bestdoctor/its_on:latest-dev
container_name: its-on
environment:
DYNACONF_HOST: '0.0.0.0'
DYNACONF_DATABASE__dsn: postgresql://itson:strongpassword@db:5432/itson
DYNACONF_REDIS_URL: redis://cache:6379/0
DYNACONF_CACHE_URL: redis://cache:6379/1
ports:
- "127.0.0.1:8081:8081"
depends_on:
- cache
- db
Don't forget to create a superuser:
docker exec -t its-on python scripts/create_user.py --login=admin \
--password=password \
--is_superuser
Navigate to http://127.0.0.1:8081/api/docs
in your browser and
you are good to go!
Run make test
We would love you to contribute to our project. It's simple:
- Create an issue with bug you found or proposal you have. Wait for approve from maintainer.
- Create a pull request. Make sure all checks are green.
- Fix review comments if any.
- Be awesome.
Here are useful tips:
- You can run all checks and tests with
make check
. Please do it before CI does. - We use BestDoctor python styleguide. Sorry, styleguide is available only in Russian for now.
- We respect Django CoC. Make soft, not bullshit.