/VRME-Server-Rust

VRME server written in Rust.

Primary LanguageRustMIT LicenseMIT

Virtual Reality Meeting Environment Backend Server

GitHub code size in bytes GitHub GitHub deployments

Development

The project is written in Rust. It is written in Rust Edition 2018, using the latest stable release.

  • We use Cargo for the package manager.
  • We use rustup for managing the tool chain.
  • We use mdBook for API endpoint documentation.
  • We use rustfmt for formatting Rust source code.

The actual Rust project is under vrme_server, so start by changing the working directory into vrme_server:

cd vrme_server

All of the instructions below assume that you are under the vrme_server directory already.

Code Documentation

If you want to generate and render code documentation for vrme_server, run

cargo doc

And the docs will be generated under target/doc.

  • If you wish to open the documentation in the browser directly, run instead (the browser executable pointed to by $BROWSER):

    cargo doc --open
  • If you don't want to generate docs for dependency crates, specify the --no-deps flag to cargo doc

    cargo doc --no-deps --open

API Documentation

Available at VRME-API-Documentation.

Logging Level

To specify the logging level, provide LOG with one of:

Verbosity LOG=
Most verbose TRACE
DEBUG
INFO
WARN
Least verbose ERROR

LOG=INFO is the default logging level.

Example log level setting:

LOG=WARN RUN_MODE=production cargo run --release

Configuration

Run the application in either development mode or production mode by specifying RUN_MODE:

  • Production mode:

    RUN_MODE=production cargo run --release

    The --release flag passed to cargo enables -O3 optimization by default which is suitable for production mode, but erases useful debugging information for development.

  • Development mode:

    RUN_MODE=development cargo run

The server will:

  1. Read from a base (shared) configuration file:

    # Copy example default configuration
    cp config/default.example.toml config/default.toml
  2. Read from a RUN_MODE-dependent configuration file.

    Change $RUN_MODE below to either production or development.

    # Copy example $RUN_MODE-dependent configuration
    cp config/$RUN_MODE.example.toml config/$RUN_MODE.toml
  3. Read from environment variables that have the same key name as the ones in the configuration file. The environment variables need to be prefixed by APP_. When the configuration is nested, such as server.hostname, use the separator __ to replace the dot as the name of the environment variable.

    Example: server.hostname is overriden by APP_SERVER__HOSTNAME.

    # Override `server.hostname`
    APP_SERVER__HOSTNAME=127.0.0.1 \
        RUN_MODE=development \
        cargo run

Environment variables take precedence over RUN_MODE-specific configuration files, which in turn take precedence over the default shared configuration file.

See the src/settings module for the most accurate configuration options.