Aller au contenu principal

NodeCG Configuration

NodeCG is configured via a cfg/nodecg.js, cfg/nodecg.yaml, or cfg/nodecg.json file with the following schema:

Schema

  • host String The IP address or hostname that NodeCG should bind to. [DEFAULT: "0.0.0.0"]
  • port Integer The port that NodeCG should listen on. [DEFAULT: 9090]
  • baseURL String The URL of this instance. Used for things like cookies. If you use a reverse proxy, you'll likely need to set this value. [DEFAULT: HOST:PORT]
  • exitOnUncaught Boolean Whether or not to exit on uncaught exceptions. [DEFAULT: true]
  • logging Object Contains other configuration properties.
    • console Object Contains properties for console logging.
      • enabled Boolean Whether to enable console logging. [DEFAULT: true]
      • level String Lowest importance of messages which should be logged. Must be "verbose", "debug", "info", "warn" or "error" [DEFAULT: "info"]
      • timestamps Boolean Whether to add timestamps to the console logging. [DEFAULT: true]
      • replicants Boolean Whether to enable logging of the Replicants subsystem. Very spammy. [DEFAULT: false]
    • replicants Boolean Whether to enable logging of the Replicants subsystem. Very spammy. [DEFAULT: false]
      • timestamps Boolean Whether to add timestamps to the console logging. [DEFAULT: true]
      • level String Lowest importance of messages which should be logged. Must be "verbose", "debug", "info", "warn" or "error" [DEFAULT: "info"]
    • file Object Contains properties for file logging.
      • enabled Boolean Whether to enable file logging. [DEFAULT: false]
      • replicants Boolean Whether to enable logging of the Replicants subsystem. Very spammy. [DEFAULT: false]
      • timestamps Boolean Whether to add timestamps to the file logging. [DEFAULT: true]
      • level String Lowest importance of messages which should be logged. Must be "verbose", "debug", "info", "warn" or "error" [DEFAULT: "info"]
      • path String The filepath to log to. [DEFAULT: "logs/nodecg.log"]
  • bundles Object Contains configuration for bundles.
    • enabled Array of strings A whitelist array of bundle names that will be the only ones loaded at startup. Cannot be used with bundles.disabled. [DEFAULT: null -> this bundle whitelist feature is disabled -> load all bundles]
    • disabled Array of strings A blacklist array of bundle names that will not be loaded at startup. Cannot be used with bundles.enabled. [DEFAULT: null -> no bundle blacklisted from loading / all bundles are loaded]
    • paths Array of strings An array of additional ABSOLUTE paths where bundles are located. [DEFAULT: [] (empty array)]
  • login Object Contains other configuration properties.
    • enabled Boolean Whether to enable login security. [DEFAULT: false]
    • sessionSecret String The secret used to salt sessions. This option is required when login.enabled = true! [NO DEFAULT!]
    • forceHttpsReturn Boolean Forces Steam & Twitch login return URLs to use HTTPS instead of HTTP. Useful in reverse proxy setups. [DEFAULT: false]
    • local Object Contains local username & password login configuration properties.
      • enabled Boolean Whether to enable Local authentication. [DEFAULT: false]
      • allowedUsers Array of objects Which usernames and passwords to allow. Example: {"username": "admin", "password": "foo123"}. This option is required when login.local.enabled = true! [NO DEFAULT!]
    • steam Object Contains steam login configuration properties.
      • enabled Boolean Whether to enable Steam authentication. [DEFAULT: false]
      • apiKey String A Steam API Key. Obtained from http://steamcommunity.com/dev/apikey. This option is required when login.steam.enabled = true! [NO DEFAULT!]
      • allowedIds Array of strings Which 64 bit Steam IDs to allow. Can be obtained from https://steamid.io/. This option is required when login.steam.enabled = true! [NO DEFAULT!]
    • twitch Object Contains twitch login configuration properties.
      • enabled Boolean Whether to enable Twitch authentication. [DEFAULT: false]
      • clientID String A Twitch application ClientID http://twitch.tv/kraken/oauth2/clients/new. This option is required when login.twitch.enabled = true! [NO DEFAULT!]
      • clientSecret String A Twitch application ClientSecret http://twitch.tv/kraken/oauth2/clients/new. This option is required when login.twitch.enabled = true! [NO DEFAULT!]
      • Note: Configure your Twitch OAuth credentials with a Redirect URI to {baseURL}/login/auth/twitch
      • scope String A space-separated string of Twitch application permissions. [DEFAULT: "user_read"]
      • allowedUsernames Array of strings Which Twitch usernames to allow. Either this option or allowedIds is required when login.twitch.enabled = true! [NO DEFAULT!]
      • allowedIds Array of strings Which Twitch IDs to allow. Can be obtained from https://twitchinsights.net/checkuser. Either this option or allowedUsernames is required when login.twitch.enabled = true! [NO DEFAULT!]
    • discord Object Contains discord login configuration properties.
      • enabled Boolean Whether to enable Discord authentication. [DEFAULT: false]
      • clientID String A Discord application ClientID https://discord.com/developers/applications/. This option is required when login.discord.enabled = true! [NO DEFAULT!]
      • clientSecret String A Discord application ClientSecret https://discord.com/developers/applications/
      • Note: Configure your Discord OAuth credentials with a Redirect URI to {baseURL}/login/auth/discord. This option is required when login.discord.enabled = true! [NO DEFAULT!]
      • scope String A space-separated string of Discord application permissions. [DEFAULT: "identify"]
      • allowedUserIDs Array of strings Which Discord IDs to allow. Either this option or allowedGuilds is required when login.discord.enabled = true! [NO DEFAULT!]
      • allowedGuilds Array of objects Which servers to allow users from. Either this option or allowedUserIDs is required when login.discord.enabled = true! [NO DEFAULT!]
      • Format for allowedGuilds objects
        • guildID String Users in this Discord Server are allowed to log in
        • allowedRoleIDs Array of strings Additionally require one of the roles on the server to log in
        • guildBotToken String Discord bot token, needed if allowedRoleIDs is used https://discord.com/developers/applications/
  • ssl Object Contains HTTPS/SSL configuration properties.
    • enabled Boolean Whether to enable SSL/HTTPS encryption. [DEFAULT: false]
    • allowHTTP Boolean Whether to allow insecure HTTP connections while SSL is active. [DEFAULT: false]
    • keyPath String The path to an SSL key file. This option is required when ssl.enabled = true! [NO DEFAULT!]
    • certificatePath String The path to an SSL certificate file. This option is required when ssl.enabled = true! [NO DEFAULT!]
    • passphrase String The passphrase for the provided key file. [OPTIONAL]
  • sentry Object Contains Sentry configuration properties.
    • enabled Boolean Whether to enable Sentry error reporting. [DEFAULT: false]
    • dsn String Your Sentry API key for error reporting. This option is required when sentry.enabled = true! [NO DEFAULT!]

Example Config

cfg/nodecg.js
module.exports = {
host: '0.0.0.0',
port: 9090,
bundles: {
enabled: ['bundle-name'],
paths: ['C:\\nodecg\\experimental-bundles'],
},
login: {
enabled: true,
sessionSecret: 'supersecret',
steam: {
enabled: true,
apiKey: 'YYYYY',
allowedIds: ['11111111111111111', '22222222222222222'],
},
twitch: {
enabled: true,
clientID: 'your_app_id',
clientSecret: 'your_app_key',
scope: 'user_read',
allowedUsernames: ['some_username'],
allowedIds: ['11111111111111111', '22222222222222222'],
},
discord: {
enabled: true,
clientID: 'your_discord_app_client_id',
clientSecret: 'your_discord_app_client_secret',
scope: 'identify guilds',
allowedUserIDs: ['159600065017675778', '54561421005950976'],
allowedGuilds: [
{
guildID: '754749209722486814',
allowedRoleIDs: ['754751725457637546', '755012946400378910'],
guildBotToken: 'your_bot_token',
},
{
guildID: '754749209722486814',
},
],
},
},
logging: {
console: {
enabled: true,
timestamps: false,
level: 'verbose',
replicants: false,
},
file: {
enabled: true,
timestamps: true,
path: 'logs/server.log',
level: 'info',
replicants: false,
},
},
ssl: {
enabled: false,
keyPath: '',
certificatePath: '',
},
sentry: {
enabled: true,
dsn: 'https://xxx:yyy@sentry.io/zzz',
},
};