Cadet is the web application powering Source Academy.
- Elixir 1.8
- Erlang/OTP 21
- PostgreSQL (>= 9.6)
- Setup the development secrets (replace the values appropriately)
$ cp config/secrets.exs.example config/secrets.exs
$ vim config/secrets.exs
- A valid
luminus_api_key
,luminus_client_id
,luminus_client_secret
andluminus_redirect_url
are required for the application to properly authenticate with LumiNUS.* - A valid
cs1101s_repository
,cs1101s_rsa_key
is required for the application to run with the--updater
flag. Otherwise, the default values will suffice. - A valid
instance_id
,key_id
andkey_secret
are required to use ChatKit's services. Otherwise, the placeholder values can be left as they are.
*If you require access to Luminus keys please email Prof Henz at [email protected] to request for a with the email subject heading "Request for Luminus API Keys".
- Install Elixir dependencies
$ mix deps.get
- Initialise development database
$ mix ecto.setup
- Run the server in your local machine
$ mix phx.server
- You may now make API calls to the server locally via
localhost:4000
. The API documentation can also be accessed at http://localhost:4000/swagger.
You can obtain access_token
JWT of a user with a given role by simply running:
$ mix cadet.token <role>
For more information, run
$ mix help cadet.token
We recommend setting up nginx to handle preflight checks using the following config file.
If you do this, do remember to point cadet-frontend to port 4001
instead of 4000
The chat functionality is built on top of Chatkit and provides two-way communication between cadets and avengers. This replaces the previous comment field found in assignments. Its documentation can be found here.
If you are using Chatkit, obtain your instance ID, key ID and secret key from your account, and set them in. Instructions to that are found here.
Internet connection is required for usage.
We follow this style guide: https://github.com/lexmag/elixir-style-guide and https://github.com/christopheradams/elixir_style_guide
Where there is a conflict between the two, the first one (lexmag) shall be the one followed.
Generated with DBeaver on 8 September 2019