Rak v0.1.1 Rak

Rak Game Server Maker

The top level module is used to define how your server will be composed. In here, we define which services to use, and how they will connect to each other.

defmodule MyApp do
    use Rak, 
        metrics: Rak.Metrics.Prometheus,
        service: MyApp.Service,
        module: :auto,
        discovery: Rak.Discovery.Consul,
        connector: [
            module: Rak.Connector.Web,
            message: Rak.Message.Raw,
            session: Rak.Session.Basic
        ]
end

You may specify multiple entries for each components, or remove them if you do not use them.

module: :auto is a wildcard configuration entry that lets Rak know to load all top-level modules automatically.

Finally, you may want to configure which modules to start depending on the environment you are running. For instance, you may not want to start the discovery service when developing locally. In such cases, you may move the configuration to your config/config.exs and override it depending on the environment.

lib/my_app.ex

defmodule MyApp do
    use Rak
end

config/config.exs

use Mix.Config

config :my_app, 
    rak: [
        metrics: Rak.Metrics.Prometheus,
        service: MyApp.Service,
        module: :auto,
        discovery: Rak.Discovery.Consul,
        connector: [
            module: Rak.Connector.Web,
            message: Rak.Message.Raw,
            session: Rak.Session.Basic
        ]
    ]