https://github.com/backwardspy/api-reflector
Configurable API mocking service
https://github.com/backwardspy/api-reflector
hacktoberfest
Last synced: about 1 year ago
JSON representation
Configurable API mocking service
- Host: GitHub
- URL: https://github.com/backwardspy/api-reflector
- Owner: backwardspy
- License: mit
- Created: 2021-07-25T20:51:10.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-03T15:05:41.000Z (over 1 year ago)
- Last Synced: 2025-04-10T14:42:35.828Z (about 1 year ago)
- Topics: hacktoberfest
- Language: Python
- Homepage:
- Size: 905 KB
- Stars: 4
- Watchers: 11
- Forks: 2
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# api-reflector

A configurable API mocking service.
## Development
api-reflector uses [poetry](https://python-poetry.org) for dependency
management.
It is recommended that you use poetry 1.2+ along with
[poetry-dotenv-plugin](https://github.com/mpeteuil/poetry-dotenv-plugin) for
easier project configuration.
```shell
$ poetry install
$ poetry shell
$ api-reflector-migrate
$ flask run
```
All configuration is done via environment variables. If you are using
`poetry-dotenv-plugin` or another dotenv tool, you can use a `.env` file in the
project root to set configuration variables. `.env.example` is provided as an
example. If you use the example dotenv file, make sure you update `secret_key`.
## Azure auth
Azure SSO can be enabled by setting azure_auth_enabled to `true` in your environment.
If Azure SSO is enabled, three extra environment variables need to be provided:
```
azure_client_id
azure_client_secret
azure_tenant
```
### Local Testing
By default, insecure redirect URLS will be rejected.
If you want to test locally, set OAUTHLIB_INSECURE_TRANSPORT=true in your environment.
## Docker-compose
Spin up postgres and api reflector containers with docker compose:
From project root:
```sh
docker-compose -f docker-compose-local.yml up
```
Exposed ports:
`posgtres: 5438`
`apireflector: Go to browser on http://localhost:6502`
## Required Kubernetes Annotations for Ingress
If you use an external service for proxying traffic into your Kubernetes clusters such as Azure Front Door or Cloudflare, you'll need to pass the following example annotation:
```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/upstream-vhost: reflector.example.com # <-- this one right here.
```