Deploy
This commit is contained in:
parent
379ee14739
commit
0ed480777e
9 changed files with 214 additions and 68 deletions
|
|
@ -26,8 +26,7 @@
|
|||
"clean-webpack-plugin": "^3.0.0",
|
||||
"common-config-webpack-plugin": "^2.0.1",
|
||||
"css-loader": "^1.0.1",
|
||||
"firebase": "^7.22.0",
|
||||
"gl-matrix": "^3.3.0",
|
||||
"gl-matrix": "3.3.0",
|
||||
"html-webpack-inline-source-plugin": "^1.0.0-beta.2",
|
||||
"html-webpack-inline-svg-plugin": "^2.3.0",
|
||||
"html-webpack-plugin": "^4.5.0",
|
||||
|
|
|
|||
|
|
@ -1,42 +1,19 @@
|
|||
import firebase from 'firebase/app';
|
||||
import 'firebase/firebase-remote-config';
|
||||
/**
|
||||
* Hardcoded list of game servers the landing page offers to players.
|
||||
*
|
||||
* Each entry is the public origin of a dockerized `declared-server` instance.
|
||||
* The join screen polls `<origin>/state` (see `serverInformationEndpoint`) and
|
||||
* only shows a server once it responds, so listing an offline origin here is
|
||||
* harmless. Add or remove origins as you deploy more server containers.
|
||||
*/
|
||||
const servers: Array<string> = ['https://server.decla.red'];
|
||||
|
||||
export abstract class Configuration {
|
||||
private static remoteConfig: firebase.remoteConfig.RemoteConfig;
|
||||
private static initialized = false;
|
||||
|
||||
public static async initialize(): Promise<void> {
|
||||
if (this.initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
const firebaseConfig = {
|
||||
apiKey: 'AIzaSyBG85dp-AhaCW-qi_6mu77wDPSipzipIF4',
|
||||
authDomain: 'decla-red.firebaseapp.com',
|
||||
projectId: 'decla-red',
|
||||
appId: '1:635208271441:web:c910843ae7e0549dadda70',
|
||||
};
|
||||
|
||||
firebase.initializeApp(firebaseConfig);
|
||||
|
||||
this.remoteConfig = firebase.remoteConfig();
|
||||
|
||||
this.remoteConfig.settings = {
|
||||
minimumFetchIntervalMillis: 0, // todo: 3600 * 1000,
|
||||
fetchTimeoutMillis: 15 * 1000,
|
||||
} as any;
|
||||
|
||||
await this.remoteConfig.ensureInitialized();
|
||||
await this.remoteConfig.fetchAndActivate();
|
||||
|
||||
this.initialized = true;
|
||||
// Kept async for call-site compatibility; the server list is static now.
|
||||
}
|
||||
|
||||
public static get servers(): Array<string> {
|
||||
if (!this.initialized) {
|
||||
throw new Error('Configuration should be initialized');
|
||||
}
|
||||
|
||||
return JSON.parse(this.remoteConfig.getValue('online_servers').asString());
|
||||
return servers;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue