Setting Up the DM Module on the Server

Overview

The DM module needs to be set up on all Diarkis servers that will use it (HTTP, UDP, TCP).

The setup can be easily completed by exposing built-in commands to the client.

Setup

To expose built-in commands to the client, you can easily set it up using the diarkisexec package.

Add the following to the main function of your server. Below is a sample setup for a UDP server. The setup function from diarkisexec needs to be executed before calling diarkisexec.StartDiarkis().

For more details, refer to the API reference for diarkisexec.

package main

import "github.com/Diarkis/diarkis/diarkisexec"

func main() {
	logConfigPath := "/configs/shared/log.json"
	meshConfigPath := "/configs/shared/mesh.json"

	diarkisexec.SetupDiarkis(logConfigPath, meshConfigPath, &diarkisexec.Modules{
		DM:         &diarkisexec.Options{ConfigPath: "/configs/shared/dm.json", ExposeCommands: true},
	})
	diarkisexec.SetupDiarkisUDPServer("/configs/udp/main.json")
	diarkisexec.StartDiarkis()
}

Since it’s very easy to set up the server using the server templates, we recommend starting with this. Refer to Diarkis Server Template.

Last updated