An OTP service to generate and validate users in any 2FA process intended. Written in Rust for better performance and small size.
To run this project locally with cargo run, first you need to create a .env file with the following variables:
HOST=0.0.0.0
PORT=8080
ENVIRONMENT=dev
DATABASE_URL=postgres_database_url
Note that it's necessary to have a Postgres Database instance running and change above DATABASE_URL parameter. The PORT variable can also be changed to anyone that you would.
After this setup, you can just run the bellow command:
cargo run
In order to run this project using Docker Compose, which includes the Rust API server and the PostgreSQL Database server, you must create a file named ".env.docker" (without brackets) with the following content.
a) Basic environment variables
HOST=0.0.0.0
PORT=8080
ENVIRONMENT=prod
b) Database Settings
DATABASE_HOST=db_host
DATABASE_NAME=db_schema_name
POSTGRES_USER=db_user
POSTGRES_PASSWORD=db_password
DATABASE_URL=postegres_url_connection
After this briefly setup, just run the following command in the project root directory (Unix systems only):
sh run.sh
In order to run Diesel Migrations (which will automatically generate the database entire schema for you), you must run the following command:
diesel migration run
If you don't have diesel CLI installed in your local environment, here you can find how to do that.
In future releases, Diesel Migrations will run in an embedded way, turning this step unnecessary.
- Embed Diesel migrations if environment is setted up to Development
- oauth2 API authentication
- SSL implementation