Skip to content

Commit

Permalink
allow web.json config to override master server address
Browse files Browse the repository at this point in the history
  • Loading branch information
glennhartmann committed Aug 31, 2022
1 parent b2cd3c2 commit fca40a0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ Set `content.quakejs.com` as the content server:
echo '{ "content": "content.quakejs.com" }' > bin/web.json
```

Note: you can _optionally_ also specify a master server:

```shell
cat <<EOF > bin/web.json
{
"content": "content.quakejs.com",
"master": "master.quakejs.com"
}
EOF
```

Run the server:

```shell
Expand Down
2 changes: 1 addition & 1 deletion bin/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
window.addEventListener('resize', resizeViewport);
// merge default args with query string args
var args = ['+set', 'fs_cdn', '<%= content %>'];
var args = ['+set', 'fs_cdn', '<%= content %>', '+set', 'sv_master1', '<%= master %>'];
args.push.apply(args, getQueryCommands());
ioq3.callMain(args);
};
Expand Down
4 changes: 3 additions & 1 deletion bin/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ var config = loadConfig(argv.config);
function loadConfig(configPath) {
var config = {
port: 8080,
content: 'localhost:9000'
content: 'localhost:9000',
master: 'master.quakejs.com'
};

try {
Expand All @@ -45,6 +46,7 @@ function loadConfig(configPath) {
app.use(express.static(path.join(__dirname, '..', 'build')));
app.use(function (req, res, next) {
res.locals.content = config.content;
res.locals.master = config.master;
res.render('index');
});

Expand Down

0 comments on commit fca40a0

Please sign in to comment.