Skip to content

RoOps-Services/RoOps-Internal-API

Repository files navigation

Setup

Note

A local configuration must be set up before you can start up the server

To start up the server, run:

cargo run

Make sure you execute the following commands prior to pushing your changes:

cargo test # Ensure all tests are passing
cargo fmt # Run the code formatter
cargo clippy # Ensure no warnings/errors are produced by the linter

Config

A config.toml file can be created in the root directory of the project. The file is used to configure the server.

To validate your local configuration setup, run:

cargo run validate-config

CORS

The cors section of the config file is used to configure the CORS settings for the server. If the request origin is not in the list of allowed origins, the server will respond with a 403 Forbidden status code.

If the allowed_methods field is set, the server will respond with a 405 Method Not Allowed status code if the request method is not in the list of allowed methods.

If neither the allowed_origins_exact nor the allowed_origins_regex fields are set, the server will accept requests from any origin.

# CORS settings (optional)
[cors]
# Allowed origins for CORS requests (exact match), default: []
allowed_origins_exact = ["http://localhost:8000"]
# Allowed origins for CORS requests (regular expression), default: []
allowed_origins_regex = ["^http://localhost:\\d{4}$"]
# Allowed methods for CORS requests, default: all
allowed_methods = ["GET", "POST", "PUT", "DELETE"]
# Whether to allow credentials in CORS requests, default: false
allow_credentials = true

OAuth2

The oauth2 section of the config file is used to configure the OAuth2 settings for the server. Any sensitive data should be stored in the environment variables.

# Discord OAuth2 settings (required)
[oauth.discord]
# Client ID (required)
client_id = "CLIENT_ID"
# Callback URL (required)
redirect_uri = "http://localhost:8000/v1/oauth2/discord/callback"

# Roblox OAuth2 settings (required)
[oauth.roblox]
# Client ID (required)
client_id = "CLIENT_ID"
# Callback URL (required)
redirect_uri = "http://localhost:8000/v1/oauth2/roblox/callback"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •