Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
node_modules
config.local.js
.vscode/launch.json
log.txt

9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"eslint.enable": true,
"eslint.validate": [
"javascript", // ...
"html" // Add "html" to enable linting `.html` files.
]
}
4 changes: 2 additions & 2 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ sudo apt install screen

## Configuration
### API:
- Edit the settings in config.js - at least the first 5. They are explained in the file.
- The API loads config.local.js when it exists and otherwise falls back to config.js. Use config.local.js for machine-specific settings and secrets; it is ignored by Git. Keep the generic defaults in config.js.
- The API uses steam authentication which returns a Steam ID as URL (https://steamcommunity.com/openid/id/{steamid}). The last part is the SteamID64, which can be calculated from the other SteamID formats - various online tools are available. In the configuration, an array needs to be filled with the comma separated IDs of your intended admins as strings (e.g. ['{steamid-1}', '{steamid-2}']).
- To display map preview images, a steamAPI key is needed. See https://steamcommunity.com/dev/apikey how to get one.
It must be copied to the respective config option. To learn more on how the map-handling works see [Maps TL;DR](https://github.com/Taraman17/nodejs-cs2-api/blob/master/MAPS.MD)
Expand All @@ -59,7 +59,7 @@ following arguments are added to the CL:
If a running server is detected, the logging settings will be set via rcon.

If you need to change these and know what you are doing, you can edit them in "modules/configClass.js"
You can add optional command line arguments in config.js
You can add optional command line arguments in the active configuration file.

## Starting
Start the script with
Expand Down
172 changes: 89 additions & 83 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,86 +1,92 @@
var config = {
// Network interface over which the server is communicating. We set this and not the
// IP-address, in case the server is using DHCP in a LAN and not a static address.
"iface": "eth0",
// The server-root of your installation () - with slash at the end.
"csgoDir": "/home/<your_user>/cs2_ds/",
// Well, the rcon password...
"rconPass": "YourRconPass",
// Array of SteamID64 of Users who are allowed to control the server. For info on SteamID64 see:
// https://steamcommunity.com/discussions/forum/1/364039785160857002/
"admins": [],
// The path to screen.
"screen": "/usr/bin/screen",

/* Optional settings */
// Anything you want your server command line to have additional to:
// -console -usercon -ip 0.0.0.0 +sv_logfile 1 -serverlogging
// +logaddress_add_http "http://${this._localIp}:${this.logPort}/log"
"csgoOptionalArgs": "",
// steam serverToken for public access. To get one see https://steamcommunity.com/dev/managegameservers
"serverToken": "",
// Steam Web API token. Needed to get mapdetails like thumbnail, etc
// See https://steamcommunity.com/dev/apikey how to get one.
"apiToken": "",
// Workshop Collection to host on the server.
"workshopCollection": "",
// List of workshop ids of maps to add to available maps.
"workshopMaps": [ // '23423523523525',
// '37281723987123'
],
// If you want to use a different name / location for the update script (absolute path).
"updateScript": "",
// Time in minutes, after which a new login is needed.
"loginValidity": 300,
// Use http authentication [true/false]
"httpAuth": false,
// User for digest Authentication.
"httpUser": { "username": "", "password": "" },
// Port, the webserver for API calls listens on.
"apiPort": 8090,
// Set to true if you use Websockets for status updates.
// this is the standard and support for running without websockets will be removed in the future.
"webSockets": true,
// Port, the websocket is listening on.
"socketPort": 8091,
// Port the Logreceiver listens on.
"logPort": 8092,
// https settings
"useHttps": false,
// Hostname the certificates are valid for (e.g.: yourdomain.org).
"host": "",
// If you use https, add the path to the certificate files here.
"httpsCertificate": "",
"httpsPrivateKey": "",
// In case your CA is not trusted by default (e.g. letsencrypt), you can add
// the CA-Cert here.
"httpsCa": "",
// Change this to any string of your liking to make it harder for attackers to profile your cookies.
"sessionSecret": "nodejs-csgo-api",
// The Page the client is redirected to after login if you are using a seperate webserver.
"redirectPage": "",
// The name screen will give the process (no spaces allowed).
"screenName": "cs2Server",
// The screen Logfile where the console output of screen and the server will be logged.
// New logs are appended, so you may need to delete or rotate this log periodically.
"screenLog": "screen.log",
// Path to steamcmd, can stay like this if installed via package manager.
"steamExe": "steamcmd",
// Scripts to run on various events. Use absolute path.
"logStartScript": "",
"mapStartScript": "",
"matchStartScript": "",
"roundStartScript": "",
"roundEndScript": "",
"matchEndScript": "",
//"mapEndScript": "", // For the moment I have no definite way to sense the end of map.
"logEndScript": "",
// Logfile for API
"logFile": "./logs/csgoapi",
// logLevel for API-Logfiles. In case "debug" is set, logs will also be written to console.
"logLevel": "http",
// how many Days should logfiles be kept?
"logDays": "14"
// Type of server. local executable or docker with compose file.
// Options: local/docker
type: "local",
// Network interface over which the server is communicating. We set this and not the
// IP-address, in case the server is using DHCP in a LAN and not a static address.
iface: "eth0",
// The server-root of your installation () - with slash at the end.
csgoDir: "/home/<your_user>/cs2_ds/",
// Well, the rcon password...
rconPass: "YourRconPass",
// Array of SteamID64 of Users who are allowed to control the server. For info on SteamID64 see:
// https://steamcommunity.com/discussions/forum/1/364039785160857002/
admins: [],
// The path to screen.
screen: "/usr/bin/screen",
// Path to docker compose file
dockerfile: "/home/<your_user>/cs2_docker/docker-compose.yaml",

/* Optional settings */
// Anything you want your server command line to have additional to:
// -console -usercon -ip 0.0.0.0 +sv_logfile 1 -serverlogging
// +logaddress_add_http "http://${this._localIp}:${this.logPort}/log"
csgoOptionalArgs: "",
// steam serverToken for public access. To get one see https://steamcommunity.com/dev/managegameservers
serverToken: "",
// Steam Web API token. Needed to get mapdetails like thumbnail, etc
// See https://steamcommunity.com/dev/apikey how to get one.
apiToken: "",
// Workshop Collection to host on the server.
workshopCollection: "",
// List of workshop ids of maps to add to available maps.
workshopMaps: [
// '23423523523525',
// '37281723987123'
],
// If you want to use a different name / location for the update script (absolute path).
updateScript: "",
// Time in minutes, after which a new login is needed.
loginValidity: 300,
// Use http authentication [true/false]
httpAuth: false,
// User for digest Authentication.
httpUser: { username: "", password: "" },
// Port, the webserver for API calls listens on.
apiPort: 8090,
// Set to true if you use Websockets for status updates.
// this is the standard and support for running without websockets will be removed in the future.
webSockets: true,
// Port, the websocket is listening on.
socketPort: 8091,
// Port the Logreceiver listens on.
logPort: 8092,
// https settings
useHttps: false,
// Hostname the certificates are valid for (e.g.: yourdomain.org).
host: "",
// If you use https, add the path to the certificate files here.
httpsCertificate: "",
httpsPrivateKey: "",
// In case your CA is not trusted by default (e.g. letsencrypt), you can add
// the CA-Cert here.
httpsCa: "",
// Change this to any string of your liking to make it harder for attackers to profile your cookies.
sessionSecret: "nodejs-csgo-api",
// The Page the client is redirected to after login if you are using a seperate webserver.
redirectPage: "",
// The name screen will give the process (no spaces allowed).
screenName: "cs2Server",
// The screen Logfile where the console output of screen and the server will be logged.
// New logs are appended, so you may need to delete or rotate this log periodically.
screenLog: "screen.log",
// Path to steamcmd, can stay like this if installed via package manager.
steamExe: "steamcmd",
// Scripts to run on various events. Use absolute path.
logStartScript: "",
mapStartScript: "",
matchStartScript: "",
roundStartScript: "",
roundEndScript: "",
matchEndScript: "",
//"mapEndScript": "", // For the moment I have no definite way to sense the end of map.
logEndScript: "",
// Logfile for API
logFile: "./logs/csgoapi",
// logLevel for API-Logfiles. In case "debug" is set, logs will also be written to console.
logLevel: "http",
// how many Days should logfiles be kept?
logDays: "14",
};

module.exports = config;
module.exports = config;
Loading
Loading