Skip to content

Configuration

PhlexPlexico edited this page Oct 26, 2020 · 11 revisions

In order to configure the application, there are a few .template files located under ./config. These files are meant to assist in a quick setup. In order to run the application in a given environment, please copy the file and rename it to development/test/production.json dependent on what environment you wish to run. Here is the example in question for development:

{
  "server": {
    "port": 3301,
    "hostname": "http://localhost",
    "dbKey": "Database 16 Byte Key.",
    "steamAPIKey": "API Key For Steam Calls.",
    "sharedSecret": "a secure secret for jwt sigining.",
    "clientHome": "http://localhost:8080",
    "useRedis": true
  },
  "development": {
    "driver": "mysql",
    "user": "get5_user",
    "password": "",
    "database": "get5dev",
    "multipleStatements": true,
    "flags": { "ENV": "MYSQL_FLAGS" },
    "host": "127.0.0.1",
    "port": 3306,
    "connectionLimit": 15,
    "redisHost": "localhost",
    "redisPort": 6379,
    "redisTTL": 86400,
    "redisPass": "super_secure"
  },
  "admins": {
    "steam_ids": "admins,go,here"
  },
  "super_admins": {
    "steam_ids": "super_admins,go,here"
  }
}

We'll go through section-by-section to determine what is needed to change, and what isn't.

Server

Inside the server block, you will see a few options. The port is reference to where the API will bind itself to. The default I left was 3301. You may change this to whatever you like, so long as it isn't conflicting with other applications, such as Apache/Tomcat.

Next is the hostname. Since get5 requires a valid hostname, you can not simply use an IP. Please register a domain, or use something like DuckDNS to create a hostname!

The dbKey field is a 16 byte key used to generate some security for storing RCON passwords in the database. I recommend using Random.org to generate a 16 byte hexadecimal value, and stripping the whitespace between the numbers.

The steamAPIKey is the developer API key that you must retrieve from Steam. Just paste this key within the quotes.

The sharedSecret is used to save sessions to a cookie. Make sure you make this as unique as possible to avoid anyone gaining unauthorized user access.

The clientHome is a URL to use on redirects during authentication. This is what your front-end URL is supposed to be. In this case, G5V uses localhost:8080 to run its development server on, so it is set to that. If you wish to use this over the network, and not just your machine, set it to your front-ends local IP address. CORS is also enabled for that URL specifically, to prevent any unauthorized usage of the API.

The useRedis option (true/false) is mainly used for setup and config. Depending on your setup, you may not be able to run a redis instance for session storage. Just switch this to false, and you will be able to use the applications session storage. This is not recommended however, so please make sure you get a redis-server running.

Development/Test/Production

This block of configuration is where all the database information goes. The main thing you have to worry about during setup is the following:

user is the user that you had created in steps prior. If you followed the wiki, this would be get5_user.

password is the password you created at the time of creating the database user as well, paste that password in there.

database, depending on what file/environment you use, this will be either get5dev, get5test, or get5.

host is dependent on wherever your database is hosted. If on a separate server, please fill in the correct IP. If it is running on the same machine, leave it as is.

port is only changed if you have changed the default port of your mysql installation. Leave it as is if you have not.

redisHost is the same as host above. Leave if it Redis is installed on the machine running the API.

redisPass is the password that you placed in the redis.conf file on your system, please paste it in there.

Admins/Super Admins

These last two sections both take Steam64 IDs that are separated by commas. A super admin will have access to RCON passwords of all the servers, and would be able to run any RCON commands against a game server as well. An admin has a bit less access, but should be able to cancel matches, edit teams, etc.

Finish

Once this is all setup, run yarn to get all the dependencies, set your NODE_ENV and then yarn start! The API will be up and running!

Clone this wiki locally