Download repository
git clone https://github.com/Bondifuzz/api-gateway.git
cd api-gatewayBuild docker image
docker build -t api-gateway .Run container (locally)
docker run --net=host --rm -it --name=api-gateway --env-file=.env api-gateway bashUsing python 3.7+
git clone https://github.com/Bondifuzz/api-gateway.git && cd api-gateway
pip3 install -r requirements-dev.txt
ln -s local/dotenv .env
ln -s local/docker-compose.yml docker-compose.yml
docker-compose -p api_gateway up -d
python3 -m uvicorn \
--factory api_gateway.app.main:create_app \
--host 127.0.0.1 \
--port 8080 \
--workers 1 \
--log-config logging.yaml \
--lifespan onpython3 -m uvicorn --factory api_gateway.app.main:generate_api_spec
TODO
Install dependencies:
pip3 install -r requirements-test.txtRunning unit tests:
pytest -vv api-gateway/tests/unitDisable security to run tests
sed -i "s/COOKIE_MODE_SECURE=.*/COOKIE_MODE_SECURE=0/g" .env
sed -i "s/CSRF_PROTECTION_ENABLED=.*/CSRF_PROTECTION_ENABLED=0/g" .env
pytest -vv api_gateway/tests/integration --ignore=api_gateway/tests/integration/test_csrf_protection.pyIf you want to run CSRF protection tests, enable security
sed -i "s/CSRF_PROTECTION_ENABLED=.*/CSRF_PROTECTION_ENABLED=1/g" .env
pytest -vv api_gateway/tests/integration/test_csrf_protection.pyDownload cspell and run to check spell in all sources
sudo apt install nodejs npm
sudo npm install -g cspell
cspell "**/*.{py,md,txt}"ms-python.pythonms-python.vscode-pylancestreetsidesoftware.code-spell-checker