aboutsummaryrefslogtreecommitdiff
path: root/instance-options.nix
diff options
context:
space:
mode:
authorstuebinm2021-02-26 20:41:14 +0100
committerstuebinm2021-02-26 20:41:14 +0100
commitfe9853c5f4e5b029e88c73ed76ea1aaea107cc55 (patch)
tree179f4868401b60febd6621201d25272112a32cf0 /instance-options.nix
parentf32d3c5efd39df558f80b862c60b2866c567d999 (diff)
better config options
Config options are now sorted according to components (pusher, backend, frontend, etc.); in addition there is a commonConfig with config for jitsi, turn, etc. Additionally, this module is now completely modular in the sense that there are no longer any global options that affect all configured workadventure instances at once.
Diffstat (limited to 'instance-options.nix')
-rw-r--r--instance-options.nix200
1 files changed, 148 insertions, 52 deletions
diff --git a/instance-options.nix b/instance-options.nix
index a2e77be..f7236da 100644
--- a/instance-options.nix
+++ b/instance-options.nix
@@ -16,7 +16,16 @@ in
with wapkgs;
{
options = rec {
+
+ settings = {};
+
+
backend = {
+ enable = mkOption {
+ default = true;
+ type = types.bool;
+ };
+
httpPort = mkOption {
default = 8081;
type = types.ints.u16;
@@ -38,6 +47,11 @@ with wapkgs;
};
pusher = {
+ enable = mkOption {
+ default = true;
+ type = types.bool;
+ };
+
port = mkOption {
default = 8080;
type = types.ints.u16;
@@ -60,26 +74,43 @@ with wapkgs;
description = "Front package to use";
};
- defaultMap = mkOption {
- default = null;
- defaultText = "not set";
- type = types.nullOr types.str;
- description = "The url to the default map, which will be loaded if none is given in the url. Must be a reachable url relative to the public map url defined in `maps.url`.";
+ debugMode = mkOption {
+ default = false;
+ description = "Whether or not to run the frontend in debug mode";
+ type = types.bool;
};
- settings = mkOption {
- default = {};
- type = types.attrsOf types.str;
- description = "Settings for workadventure's frontend.";
- example = {
- stunServer = "stun:some.stunserver:3478";
- turnServer = "turn:some.turnserver";
- turnUser = "user";
- turnPassword = "password";
- };
-
+ startRoomUrl = mkOption {
+ default = "/_/global/localhost/maps/Floor0/floor0.json";
+ description = "The workadventure map url that users join by default";
+ type = types.str;
};
-
+
+ resolution = mkOption {
+ default = 2;
+ description = "resolution of workadventure";
+ type = types.int;
+ };
+
+ zoomLevel = mkOption {
+ default = 1;
+ description = "The default zoom level of maps";
+ type = types.int;
+ };
+
+ positionDelay = mkOption {
+ default = 200;
+ description = "Delay in milliseconds between sending position events";
+ type = types.int;
+ };
+
+ maxExtrapolationTime = mkOption {
+ default = 100;
+ description = "Maximum time period in which movements of other players are extrapolated";
+ type = types.int;
+ };
+
+
urls = {
api = mkOption {
default = "/pusher";
@@ -107,16 +138,99 @@ with wapkgs;
};
};
- maps = {
- path = mkOption {
- default = workadventure.maps.outPath + "/workadventuremaps/";
- defaultText = "third_party.workadventure-nix.maps";
- type = types.path;
- description = "Maps package to use";
+ commonConfig = {
+ secretKey = mkOption {
+ default = "THECODINGMACHINE_SECRET_KEY";
+ type = types.str;
+ };
+
+ minimumDistance = mkOption {
+ default = 64;
+ type = types.int;
+ };
+
+ groupRadius = mkOption {
+ default = 48;
+ type = types.int;
+ };
+
+ allowArtillery = mkOption {
+ default = false;
+ type = types.bool;
+ };
+
+ maxUsersPerRoom = mkOption {
+ default = 600;
+ type = types.int;
+ };
+
+ cpuOverheatThreshold = mkOption {
+ default = 80;
+ type = types.int;
+ };
+
+ socketIdleTime = mkOption {
+ default = 30;
+ type = types.int;
+ };
+
+ webrtc = {
+ stun = {
+ url = mkOption {
+ default = "stun:stun.l.google.com:19302";
+ description = "The STUN server to use for peer connections";
+ type = types.str;
+ };
+ };
+ turn = {
+ url = mkOption {
+ default = "turn:coturn.workadventure.localhost:3478";
+ description = "The TURN server to use for peer connections";
+ type = types.str;
+ };
+ user = mkOption {
+ default = "workadventure";
+ description = "Username for TURN authentication";
+ type = types.str; # TODO: also allow no user
+ };
+ password = mkOption {
+ default = "workadventure";
+ description = "Password for TURN authentication";
+ type = types.str;
+ };
+ };
+ };
+
+ jitsi = {
+ url = mkOption {
+ default = "meet.jit.si";
+ description = "Jitsi instance to use for conference rooms";
+ type = types.str;
+ };
+ privateMode = mkOption {
+ default = false;
+ description = "Jitsi private mode";
+ type = types.bool;
+ };
+ iss = mkOption {
+ default = "";
+ type = types.str;
+ };
+ secretKey = mkOption {
+ default = "";
+ type = types.str;
+ };
};
};
+
nginx = {
+ enable = mkOption {
+ default = true;
+ type = types.bool;
+ description = "enable nginx as proxy, and for serving maps";
+ };
+
default = mkOption {
default = false;
type = types.bool;
@@ -126,38 +240,20 @@ with wapkgs;
domain = mkOption {
default = "localhost";
type = types.str;
- description = "The domain name to serve workadenture services under. Mutually exclusive with domains.X";
+ description = "The domain name to serve workadenture services under.";
};
- serveDefaultMaps = mkOption {
- default = true;
- type = types.bool;
- description = "Whether to serve the maps provided by workadventure";
- };
-
- domains = {
- back = mkOption {
- default = null;
- type = types.nullOr types.str;
- description = "The domain name to serve the backend under";
- };
-
- pusher = mkOption {
- default = null;
- type = types.nullOr types.str;
- description = "The domain name to serve the pusher under";
+ maps = {
+ serve = mkOption {
+ default = true;
+ type = types.bool;
+ description = "Whether to serve maps through nginx.";
};
-
- maps = mkOption {
- default = null;
- type = types.nullOr types.str;
- description = "The domain name to serve the maps under";
- };
-
- front = mkOption {
- default = null;
- type = types.nullOr types.str;
- description = "The domain name to serve the front under";
+ path = mkOption {
+ default = workadventure.maps.outPath + "/workadventuremaps/";
+ defaultText = "third_party.workadventure-nix.maps";
+ type = types.path;
+ description = "Maps package to use";
};
};
};