Skip to content

Commit 6754534

Browse files
authored
Merge pull request #10 from Flagsmith/release/v2.0.0
Release/v2.0.0
2 parents 2e74db0 + f00aacf commit 6754534

18 files changed

+199
-113
lines changed

.github/workflows/pull-request.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ jobs:
4747
- name: Check flake8 linting
4848
run: flake8 --config=.flake8 .
4949

50-
- name: Check isort imports
51-
run: isort --check .
50+
- name: Check import order
51+
run: pre-commit run reorder-python-imports --all-files
5252

5353
- name: Run Tests
5454
run: pytest -p no:warnings

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
repos:
2-
- repo: https://github.com/PyCQA/isort
3-
rev: 5.9.3
2+
- repo: https://github.com/asottile/reorder_python_imports
3+
rev: v3.8.0
44
hooks:
5-
- id: isort
6-
name: isort (python)
5+
- id: reorder-python-imports
6+
77
- repo: https://github.com/psf/black
8-
rev: 21.10b0
8+
rev: 22.6.0
99
hooks:
1010
- id: black
1111
language_version: python3

config.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"environment_key_pairs": [
3+
{
4+
"server_side_key": "your_server_side_environment_key",
5+
"client_side_key": "your_client_side_environment_key"
6+
}
7+
],
8+
"api_poll_frequency": 10,
9+
"api_url": "https://edge.api.flagsmith.com/api/v1"
10+
}

fastapi_utils/tasks.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
from asyncio import ensure_future
44
from functools import wraps
55
from traceback import format_exception
6-
from typing import Any, Callable, Coroutine, Optional, Union
6+
from typing import Any
7+
from typing import Callable
8+
from typing import Coroutine
9+
from typing import Optional
10+
from typing import Union
711

812
from starlette.concurrency import run_in_threadpool
913

fastapi_utils/test_tasks.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
import logging
33
import time
44
from asyncio import AbstractEventLoop
5-
from typing import Any, Dict, List, NoReturn, Tuple
5+
from typing import Any
6+
from typing import Dict
7+
from typing import List
8+
from typing import NoReturn
9+
from typing import Tuple
610

711
import pytest
812
from _pytest.capture import CaptureFixture

pyproject.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
[tool.black]
77
line-length = 88
8-
target-version = ['py36', 'py37', 'py38']
8+
target-version = ['py38', 'py39', 'py310']
99
include = '\.pyi?$'
1010
exclude = '''
1111
/(
@@ -28,6 +28,3 @@ use_parentheses=true
2828
multi_line_output=3
2929
include_trailing_comma=true
3030
line_length=79
31-
known_first_party=['analytics','app','custom_auth','environments','integrations','organisations','projects','segments','users','webhooks','api','audit','e2etests','features','permissions','util']
32-
known_third_party=['_pytest','apiclient','app_analytics','axes','chargebee','core','coreapi','corsheaders','dj_database_url','django','django_lifecycle','djoser','drf_writable_nested','drf_yasg2','environs','google','influxdb_client','ordered_model','pyotp','pytest','pytz','requests','responses','rest_framework','rest_framework_nested','rest_framework_recursive','sentry_sdk','shortuuid','simple_history','six','telemetry','tests','trench','whitenoise']
33-
skip = ['migrations']

readme.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,47 @@
22

33
https://docs.flagsmith.com/advanced-use/edge-proxy
44

5+
## Configuration
6+
7+
Edge proxy can be configured using the `config.json` file located at the root.
8+
9+
### Supported configuration
10+
11+
You can set the following configuration(in config.json) to control the behaviour
12+
of edge-proxy
13+
14+
- environment_key_pairs: An array of environment key pair objects, e.g:
15+
`"environment_key_pairs":[{"server_side_key":"your_server_side_key", "client_side_key":"your_client_side_environment_key"}]`
16+
17+
- [Optional]api_poll_frequency(seconds): it is used to control how often the proxy is going to ping the server for changes,
18+
e.g: `"api_poll_frequency":10`
19+
20+
- [Optional]api_url: If you are running a self hosted version of flagsmith you can add the self hosted url here for edge-proxy to ping
21+
your server, e.g: `"api_url":"https://self.hosted.flagsmith.com/api/v1"`
22+
23+
### Here are some examples of adding local `config.json` to edge-proxy:
24+
25+
- With docker run:
26+
`docker run -v /<path-to-local>/config.json:/app/config.json flagsmith/edge-proxy:latest`
27+
28+
- With docker compose:
29+
30+
```yaml
31+
version: "3.9"
32+
services:
33+
edge_proxy:
34+
image: flagsmith/edge-proxy:latest
35+
volumes:
36+
- type: bind
37+
source: /<path-to-local>/config.json
38+
target: /app/config.json
39+
```
40+
541
## Load Testing
642
743
You can send post request with `wrk` like this:
844

945
```bash
1046
cd load-test
1147
wrk -t10 -c40 -d5 -s post.lua -H 'X-Environment-Key: NC7zfaBWg7QJhbHpUMs7tv' 'http://localhost:8001/api/v1/identities/?identifier=development_user_123456'
12-
```
48+
```

requirements-dev.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ pylint
22
pep8
33
autopep8
44
black
5-
pip-tools
65
pre-commit
76
flake8
87
pytest
98
pytest-asyncio
10-
pytest-mock
9+
pytest-mock
10+
reorder-python-imports

requirements-dev.txt

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
#
55
# pip-compile requirements-dev.in
66
#
7+
aspy-refactor-imports==3.0.1
8+
# via reorder-python-imports
79
astroid==2.9.0
810
# via pylint
911
attrs==21.2.0
1012
# via pytest
1113
autopep8==1.6.0
1214
# via -r requirements-dev.in
13-
backports.entry-points-selectable==1.1.1
15+
backports-entry-points-selectable==1.1.1
1416
# via virtualenv
15-
black==21.11b1
17+
black==22.6.0
1618
# via -r requirements-dev.in
1719
cfgv==3.3.1
1820
# via pre-commit
1921
click==8.0.3
20-
# via
21-
# black
22-
# pip-tools
22+
# via black
2323
distlib==0.3.3
2424
# via virtualenv
2525
filelock==3.4.0
@@ -46,20 +46,16 @@ packaging==21.3
4646
# via pytest
4747
pathspec==0.9.0
4848
# via black
49-
pep517==0.12.0
50-
# via pip-tools
5149
pep8==1.7.1
5250
# via -r requirements-dev.in
53-
pip-tools==6.4.0
54-
# via -r requirements-dev.in
5551
platformdirs==2.4.0
5652
# via
5753
# black
5854
# pylint
5955
# virtualenv
6056
pluggy==1.0.0
6157
# via pytest
62-
pre-commit==2.16.0
58+
pre-commit==2.20.0
6359
# via -r requirements-dev.in
6460
py==1.11.0
6561
# via pytest
@@ -84,8 +80,8 @@ pytest-mock==3.6.1
8480
# via -r requirements-dev.in
8581
pyyaml==6.0
8682
# via pre-commit
87-
regex==2021.11.10
88-
# via black
83+
reorder-python-imports==3.0.1
84+
# via -r requirements-dev.in
8985
six==1.16.0
9086
# via virtualenv
9187
toml==0.10.2
@@ -94,19 +90,10 @@ toml==0.10.2
9490
# pre-commit
9591
# pylint
9692
# pytest
97-
tomli==1.2.2
98-
# via
99-
# black
100-
# pep517
101-
typing-extensions==4.0.1
102-
# via black
10393
virtualenv==20.10.0
10494
# via pre-commit
105-
wheel==0.37.0
106-
# via pip-tools
10795
wrapt==1.13.3
10896
# via astroid
10997

11098
# The following packages are considered to be unsafe in a requirements file:
111-
# pip
11299
# setuptools

requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ marshmallow
55
flagsmith-flag-engine
66
python-decouple
77
python-dotenv
8-
8+
pydantic

0 commit comments

Comments
 (0)