1
/* global module, require */
2
3
/**
4
* @file Default options used within EasyRTC. Overriding of default options should be done using the public listen() or setOption() functions.
5
* @module easyrtc_default_options
6
* @author Priologic Software, info@easyrtc.com
7
* @copyright Copyright 2016 Priologic Software. All rights reserved.
8
* @license BSD v2, see LICENSE file in module root folder.
9
*/
10
11
var option = {};
12
13
// Application Options
14
option.appDefaultName = "default"; // The default application a connection belongs to if it is not initially specified.
15
option.appAutoCreateEnable = true; // Enables the creation of rooms from the API. Occurs when client joins a nonexistent room.
16
option.appDefaultFieldObj = null; // Default fields which are set when an application is created. In form of {"fieldName":{fieldValue:<JsonObj>, fieldOption:{isShared:<boolean>}}[, ...]}
17
option.appIceServers = [ // Array of STUN and TURN servers. By default there is only publicly available STUN servers.
18
{urls: "stun:stun.l.google.com:19302"},
19
{urls: "stun:stun.sipgate.net"},
20
{urls: "stun:217.10.68.152"},
21
{urls: "stun:stun.sipgate.net:10000"},
22
{urls: "stun:217.10.68.152:10000"}
23
];
24
25
26
// Room Options
27
option.roomDefaultEnable = true; // Enables connections joining a default room if it is not initially specified. If false, than a connection initially may be in no room.
28
option.roomDefaultName = "default"; // The default room a connection joins if it is not initially specified.
29
option.roomAutoCreateEnable = true; // Enables the creation of rooms from the API. Occurs when client joins a nonexistent room.
30
option.roomDefaultFieldObj = null; // Default fields which are set when a room is created. In form of {"fieldName":{fieldValue:<JsonObj>, fieldOption:{isShared:<boolean>}}[, ...]}
31
32
33
// Connection Options
34
option.connectionDefaultFieldObj = null; // Default fields which are set when a connection is created. In form of {"fieldName":{fieldValue:<JsonObj>, fieldOption:{isShared:<boolean>}}[, ...]}
35
36
37
// SessionOptions
38
option.sessionEnable = true; // Enable sessions. If sessions are disabled, each socket connection from the same user will be the same. Relies on Express session handling also being enabled.
39
option.sessionCookieEnable = true; // If enabled, the server will attempt to send a easyrtcsid cookie which matches the Express session id.
40
41
42
// API Hosting Options
43
option.apiEnable = true; // Enables hosting of the EasyRTC API files.
44
option.apiPublicFolder = "/easyrtc"; // Api public folder without trailing slash. Note that the demos expect this to be '/easyrtc'
45
option.apiLabsEnable = true; // Enables hosting of the EasyRTC experimental API files located in the 'labs' sub folder
46
option.apiOldLocationEnable = false; // [Depreciated] Listens for requests to core API files in old locations (in addition to the new standard locations)
47
48
49
// Demo Options
50
option.demosEnable = true;
51
option.demosPublicFolder = "/demos"; // Demos public folder without trailing slash. This sets the public URL where where demos are hosted, such as http://yourdomain/demos/
52
53
54
// Log options - Only apply if internal 'log' event is used
55
option.logLevel = "info"; // The minimum log level to show. (debug|info|warning|error|none)
56
option.logDateEnable = false; // Display timestamp in each entry
57
option.logErrorStackEnable = true; // print the stack trace in logged errors when available
58
option.logWarningStackEnable= true; // print the stack trace in logged warnings when available
59
option.logColorEnable = true; // include console colors. Disable if forwarding logs to files or databases
60
option.logObjectDepth = 7; // When objects are included in the log, this is the max depth the log will display
61
option.logMessagesEnable = false; // Log the full contents of incoming and outgoing messages. Also requires the logLevel to be set at "debug". Introduces security and performance concerns.
62
63
// Miscellaneous Server Options
64
option.updateCheckEnable = true; // Checks for updates
65
66
67
// Regular expressions for validating names and other input
68
option.apiVersionRegExp = /^[a-z0-9_.+-]{1,32}$/i; // API Version
69
option.appNameRegExp = /^[a-z0-9_.-]{1,32}$/i; // Application name
70
option.easyrtcidRegExp = /^[a-z0-9_.-]{1,32}$/i; // EasyRTC socket id (easyrtcid)
71
option.easyrtcsidRegExp = /^[a-z0-9_.-]{1,64}$/i; // EasyRTC session id (easyrtcsid)
72
option.groupNameRegExp = /^[a-z0-9_.-]{1,32}$/i; // Group name
73
option.fieldNameRegExp = /^[a-z0-9_. -]{1,32}$/i; // Field names (for defining app and room custom fields)
74
option.optionNameRegExp = /^[a-z0-9_. -]{1,32}$/i; // Option names (for defining server options)
75
option.presenceShowRegExp = /^(away|chat|dnd|xa)$/; // Allowed presence "show" values (for setPresence command)
76
option.presenceStatusRegExp = /^(.){0,255}$/; // Allowed presence "status" value
77
option.roomNameRegExp = /^[a-z0-9_.-]{1,32}$/i; // Room name
78
option.usernameRegExp = /^(.){1,64}$/i; // Username
79
80
81
// Allows the option object to be seen by the caller.
82
module.exports = option;