Server hosting a game of Battle of the Centerländ.
- Rust 99.3%
- Shell 0.7%
Resolve "Update README" Closes #61 See merge request softwaregrundprojekt/2022-2023/gruppenprojekt/group-03/server-03!49 |
||
|---|---|---|
| src | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| APKBUILD | ||
| apko.yaml | ||
| Cargo.lock | ||
| Cargo.toml | ||
| LICENSE | ||
| README.md | ||
server
Server hosting a game of Battle of the Centerländ.
Usage
The server takes the following arguments:
| Short | Long | Environment | Description | Default |
|---|---|---|---|---|
-p |
--port |
PORT |
Port to listen on | 3018 |
-b |
--board-config |
BOARD_CONFIG |
Path to board configuration | /var/lib/app/config/board.json |
-g |
--game-config |
BOARD_CONFIG |
Path to game configuration | /var/lib/app/config/game.json |
-l |
--log-level |
LOG_LEVEL |
Logging level, one of trace, debug, info, warn or error |
info |
Run server --help to see the full help message.
Podman/Docker
To run the AI via Podman or Docker, use
podman run \
-v <path to board config>:/var/lib/app/config/board.json
-v <path to game config>:/var/lib/app/config/game.json
gitlab.uni-ulm.de:5050/softwaregrundprojekt/2022-2023/gruppenprojekt/group-03/server-03
This will:
- listen on port
3018 - load the game and board configuration mounted into the container via the specified volumes
- output logging information at least on level
info
Note: You might need to log in first:
podman login -u <username> -p <access token> gitlab.uni-ulm.de:5050
Build
Prerequisites
Everything can be installed with rustup:
# Update rustup's information.
rustup update
# Install the stable Rust toolchain (if not already present).
rustup toolchain add stable
# Add rustfmt.
rustup component add rustfmt
# Add clippy.
rustup component add clippy
Building
To run the binary:
cargo run
To build a debug binary:
cargo build
The resulting binary will be under target/debug/server.
To build the binary in release mode:
cargo build --release
The resulting binary will be under target/release/server.
Testing
Code Formatting
This should not output anything when the code is formatted corretcly:
cargo fmt --check
Run the following to automatically format the Rust code:
cargo fmt
Code Analysis
Run the following to check the code for common mistakes:
cargo clippy
Tests
Run tests with the following:
cargo test