2020-06-20 23:41:13 -07:00
|
|
|
// add more to the promises later.
|
2020-06-14 15:18:43 -07:00
|
|
|
class Config {
|
|
|
|
async init() {
|
2020-06-28 15:10:00 -07:00
|
|
|
const configFileLocation = "/config";
|
2020-06-14 15:18:43 -07:00
|
|
|
|
|
|
|
try {
|
|
|
|
const response = await fetch(configFileLocation);
|
|
|
|
const configData = await response.json();
|
|
|
|
Object.assign(this, configData);
|
2020-06-16 18:55:00 -07:00
|
|
|
return this;
|
2020-06-14 15:18:43 -07:00
|
|
|
} catch(error) {
|
|
|
|
console.log(error);
|
|
|
|
// No config file present. That's ok. It's not required.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|