The XANADO server is configured by reading a JSON file containing the following fields:
auth
: A structure that gives authentication options.session_secret
: Optional secret used to sign session cookies. This lets you keep sessions alive over server restarts. If it is not given a new random string will be generated when the server starts, invalidating all existing sessions.db_file
: Optional path to file used to store usernames and passwords, relative to the root directory of the installation. Default ispasswd.json
.oauth2
: Structure containing configurations for oauth2 providers. You have to have registered the application and obtained client id's and secrets from the provider's website. These configurations are passed directly to the Passport strategy for the named provider e.g. passport-google, passport-facebook. All fields must be given.google
:logo
: logo URL e.g.module
: "passport-google-oauth20"clientID
: YOUR CLIENT IDclientSecret
: YOUR SECRETscope
:[ "profile", "email" ]
callbackURL
: Google requires a fully qualified URL, by their policies e.g.protocol://YOUR.SERVER/oauth2/callback/google
facebook
:logo
: logo URL e.g.clientID
: YOUR CLIENT IDclientSecret
: YOUR SECRETprofileFields
:["id", "displayName", "email"]
callbackURL
:"/oauth2/callback/facebook"
. Facebook requires a relative URL. Put an absolute URL in and you will get a blank page and facebook will never redirect.
game_defaults
: A structure containing defaults to apply to new games.edition
: The string name of the default edition when creating new games. Game editions can be found in theeditions
directory. Default isEnglish_Scrabble
.dictionary
: The default dictionary when creating new games. Note that the robot player requires a dictionary. Dictionaries can be found in the 'dictionaries' directory. Default isCSW2019_English
.timerType
: Type of timer to use. This can be one ofGame timer
to impose a time limit on the entire game, orTurn timer
to limit a single turn. Default is to have no timer.timeAllowed
: Time limit for a move or for the game, in minutes. IftimerType
isGame timer
defaults to 25 minutes, and to 1 minute forTurn timer
.timePenalty
: Points lost per minute overtimeAllowed
. Only used iftimerType
isGame timer
. Default is 5 points per minute.
challengePenalty
: The type of penalty to apply for a failed challenge. One ofMiss next turn
,Lose points
, orLose points per word
. Default isMiss next turn
.penaltyPoints
: The score penalty to apply for a failed challenge. Only used ifchallengePenalty
isLose points
orLose points per word
.wordCheck
:Check words after play
to check plays against the dictionary,Reject unknown words
to reject plays that are not in the dictionary with no penalty. Default is no check.
predictScore
: true or false. Whether or not to show the predicted score from tiles placed so far. Default istrue
.minPlayers
Least number of players must have joined before this game can start. Must be at least 2, default is2
.maxPlayers
: Most number of players who can join a game. Default is no limit.allowUndo
: Whether or not to allow players to undo previous moves without penalty. Default isfalse
.allowTakeBack
: Whether or not to allow players to take back their most recent move without penalty, so long as the next player hasn't challenged or played. Default istrue
.
games
: Path to the directory where games files will be stored, relative to the root of the installation. Defaults togames
.host
: name of server host. Defaults to0.0.0.0
(all interfaces). Change tolocalhost
to bind only the IP address of the host the server is running on.html_dir
: sets the directory to get top level html files from. Will usually be eitherdist
(for distribution) orhtml
(for development). Defaults todist
.https
: HTTPS configuration structure. HTTPS is required for notifications to work in the browser and may be important for protecting passwords. See here for how to create a self-signed certificate. On Linux:openssl req -newkey rsa:4096 -x509 -sha256 -days 3650 -nodes -out https.crt -keyout https.key
cert
: cert file e.g.https.cert
key
: key file e.g.https.key
mail
: Email configuration, required for mailing password resets and invitations.host
: mail hostsender
: Mail sender name and address e.g."XANADO <[email protected]>"
transport
: Structure that is passed directly to the nodemailercreateTransport
function. Refer to the nodemailer documentation. You can also set "transport" to the string "mailgun" to use a mailgun configuration.
maxAge
: maximum age of a game, in milliseconds. Where it has been longer than this since the game was last interacted with, the game will be pruned. If this is missing or <= 0, games never time out.port
: The port on the server to use. The default 9093 may be used by several other applicationsproduction
: optional boolean, when true the client code generated bynpm run build
will be used. This option can also be passed on the command-line tobin/server.js
.user_defaults
: Defaults that control the user's UI.notification
: Whether to generate UI notifications. Notifications require HTTPS. Defaults tofalse
.theme
: Layout theme, must be the name of a file incss
(no extension). Defaults todefault
.jqTheme
: Name of one of the jQuery user interface themes.warnings
: Whether to generate warning sounds. Defaults totrue
.cheers
: Whether to generate end of game cheers / groans. Defaults totrue
.tile
: Whether to make a click when a tile is placed. Defaults totrue
.turn
: Whether to bong when it's your turn. Defaults totrue
.
Example configuration file, overriding selected fields and giving oauth2, https, and mail configurations.
{
"port": 8192,
"host": "localhost",
"game_defaults": {
"edition": "French_Scrabble",
"dictionary": "ODS8_French"
},
"user_defaults": {
"jqTheme": "Le Frog",
"notification": true,
"theme": "exander77",
"tile_click": false,
"cheers": false
},
"auth": {
"session_secret": "my cookie secret",
"db_file" : "/var/www/xanado/passwd.json",
"oauth2": {
"google": {
"logo": "https://lh3.googleusercontent.com/COxit...vW6cUA",
"module": "passport-google-oauth20",
"clientID":"989235985454-b3finaffwontworkg9kbutyoucantry4.apps.googleusercontent.com",
"clientSecret":"GOSECR-etSoNottell1-d-ngyou45421hjd",
"scope": [ "profile", "email" ],
"callbackURL": "https://xanado.net:8192/oauth2/callback/google"
},
"facebook": {
"logo": "https://upload.wikimedia.org/wikipedia/commons/5/51/Facebook_f_logo_%282019%29.svg",
"clientID":"982404577829836",
"clientSecret": "7aca8323498cc80f88a642f09075750a",
"profileFields": ["id", "displayName", "email"],
"callbackURL": "https://xanado.net:8192/oauth2/callback/facebook"
}
}
},
"mail": {
"sender": "Xanado <[email protected]>",
"transport": {
"host": "isp.net"
"user": "xanado"
}
},
"https": {
"cert": "https.crt",
"key": "https.key"
}
}