Skip to content

Latest commit

 

History

History
74 lines (46 loc) · 2.88 KB

File metadata and controls

74 lines (46 loc) · 2.88 KB

PhoenixAPI 1.0

Disclaimer

You are yourself responsible for performing the steps neccecary to secure the code from unwanted attackers or data leakage, be it removal of the debug toolbar, or replacing the current signed cookie system.

By using this package, you agree to perform an audit on the code yourself, and to fix any possible issues before using it live

Setting up

You need to have the following environment variables defined:

JWT_SECRET

VIPPS_CLIENT_ID
VIPPS_CLIENT_SECRET
VIPPS_SUBSCRIPTION_KEY
VIPPS_CALLBACK_URL
VIPPS_MERCHANT_SERIAL_NUMBER

Dependencies can be installed using pip install -e '.[dev]'. It is recommended that you work in a virtualenv. I.e do this:

virtualenv venv
source venv/bin/activate
pip install -e '.[dev]'

Then run source venv/bin/activate in every terminal you want to do stuff in.

Starting the server

The server is made to run under docker. Simply run docker-compose up from the root directory. If you want to run specific commands against the container, use docker-compose run web <command>. This is useful for running tests etc. If you for some reason want to avoid docker, or if you want to port it to another containerization system, simply use docker-compose.yml and Dockerfile as documentation as to how the server is set up.

Steps to develop your own stuff

New pyramid views goes in views.py, and are registered in __init__.py. Pyramid allows you to do all kinds of cool stuff, so be sure to check the documentation.

In order to create alembic migrations(needed for the actual database to be updated when you change a model), run docker-compose run rest alembic revision --autogenerate -m "Revision name". This will auto-detect changes. Be sure to look over what changes were detected before actually applying it.

Setting up payment

Stripe

Get a SK from Stripe website. Pass it to the API as the STRIPE_API_KEY environment variable.

Set up a webhook, listening for payment_intent.succeeded. Provide the webhook secret as STRIPE_ENDPOINT_SECRET

Feature flags

Feature flags can be configured in the paste.ini to enable or disable features. These are currently in use:

  • crew - enables crew applications
  • membership - enables organizational membership
    • This is usually used to collect membership bonuses from the government, for youth orgs.
  • discord - enables discord linking
  • avatar - enables avatar upload
  • seatmap - enables seatmaps
  • vipps - enables payment by vipps
  • stripe - enables payment by stripe

Relevant documentation

Pyramid

Using alembic