Config (rivet.json)


Schema

ProjectConfig

  • extends
    optional string

    Extends a different project config.

  • registries
    optional record of union of objectss
  • modules
    record of objects
    • modules.registry
      optional string

      The name of the registry to fetch the module from.

    • modules.module
      optional string

      Overrides the name of the module to fetch inside the registry.

    • modules.config
      optional record of objects

      The config that configures how this module is ran at runtime.

    • modules.storageAlias
      optional string

      Used to store data in a consistent location in case the module name changes. This is used to construct the Postgres database schema and actor identifiers. Changing this will effectively unlink all data stored in this module. Changing it back to the old value will restore the data.

    • modules.routes
      optional object

      Config options controlling how the routes are implemented and accessed.

      • modules.routes.pathPrefix
        optional string

        The path prefix for all routes in this module.

  • runtime
    optional object
    • runtime.cors
      optional object
      • runtime.cors.origins
        array of strings

        The origins that are allowed to make requests to the server.


Extending Configs

Extending configs enables overriding settings from another backend config. This is useful in situations like:

  • Separating development & production configs
  • Separating staging & production configs

This can be done by passing the path to another JSON file to extend.

Merge Strategy

Configs are merged with:

  • registries: replace registry with same key
  • modules: replace module with same key
  • runtime: merge 1 level deep

Example

This example will override the lobbies config with a development config in rivet.dev.json.

{
	"extends": "rivet.json",
	"modules": {
		"lobbies": {
			"config": {
				"lobbies": {
					"regions": ["local"],
					"backend": {
						"localDevelopment": {
							"tags": { "test": "5" },
							"ports": {
								"game": { "protocol": "udp", "port": 7777 }
							}
						}
					}
				}
			}
		}
	}
}
rivet.dev.json