2020-04-16 23:06:52 +08:00
|
|
|
/* global __meteor_runtime_config__ */
|
2018-09-19 00:12:16 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
|
|
import fs from 'fs';
|
2018-09-25 01:46:17 +08:00
|
|
|
import YAML from 'yaml';
|
2018-09-19 00:12:16 +08:00
|
|
|
|
2020-04-16 23:06:52 +08:00
|
|
|
const YAML_FILE_PATH = process.env.BBB_HTML5_SETTINGS || 'assets/app/config/settings.yml';
|
2018-09-19 00:12:16 +08:00
|
|
|
|
|
|
|
try {
|
2018-09-25 01:46:17 +08:00
|
|
|
if (fs.existsSync(YAML_FILE_PATH)) {
|
|
|
|
const SETTINGS = YAML.parse(fs.readFileSync(YAML_FILE_PATH, 'utf-8'));
|
2018-09-19 00:12:16 +08:00
|
|
|
|
|
|
|
Meteor.settings = SETTINGS;
|
|
|
|
__meteor_runtime_config__.PUBLIC_SETTINGS = SETTINGS.public;
|
2018-09-25 01:46:17 +08:00
|
|
|
} else {
|
|
|
|
throw new Error('File doesn\'t exists');
|
2018-09-19 00:12:16 +08:00
|
|
|
}
|
|
|
|
} catch (error) {
|
2020-04-16 23:06:52 +08:00
|
|
|
// eslint-disable-next-line no-console
|
2018-09-25 01:46:17 +08:00
|
|
|
console.error('Error on load configuration file.', error);
|
2018-09-19 00:12:16 +08:00
|
|
|
}
|