Developer Documentation

Usage

The ODIN CLI is a comprehensive command-line tool for managing and interacting with the game server hosting services provided by 4Players. With this tool, you can manage apps, configure fleets, deploy servers, and perform various other operations directly from your terminal.

Key Features

  • Error Handling: In case of an error, the CLI sends an error message to stderr and exits with code 1.
  • Successful Execution: If everything works as expected, the CLI exits with code 0 and prints the result to stdout.
  • Output Formatting: Customize the output format using the --format flag.
  • Force Execution: The --force flag allows bypassing confirmation prompts.
  • Quiet Mode: The --quiet flag suppresses informational messages, providing a cleaner output.

You can use the internal help command to get a list of available commands and their descriptions:

odin --help

You can get help for a specific command by running the following command:

odin <command> --help

Authentication

Before using the CLI, users must authenticate by providing their API key. The API key can be obtained from the 4Players Console. The API key can be provided either during the initial setup or via the --api-key parameter, which is particularly useful in CI/CD environments.

To log in:

odin login --api-key=<YOUR_API_KEY>

If you omit the --api-key parameter, the CLI will prompt you to enter the API key interactively.

App Selection

Users must select an app before executing certain commands. This can be done interactively or by providing the app ID directly with the --app-id parameter, which is especially useful in automated scripts.

To select an app interactively:

odin apps select

To use a specific app via the command line in any command just add the --app-id parameter overriding the selected app:

odin <command> --app-id=<APP_ID>