replace lodash merge and mergeWith
This commit is contained in:
parent
a60d817041
commit
aa47aaa22a
@ -1,5 +1,5 @@
|
||||
import { check } from 'meteor/check';
|
||||
import _ from "lodash";
|
||||
import { defaultsDeep } from '/imports/utils/array-utils';
|
||||
|
||||
export default function addAnnotation(meetingId, whiteboardId, userId, annotation, Annotations) {
|
||||
check(meetingId, String);
|
||||
@ -19,7 +19,7 @@ export default function addAnnotation(meetingId, whiteboardId, userId, annotatio
|
||||
|
||||
const oldAnnotation = Annotations.findOne(selector);
|
||||
if (oldAnnotation) {
|
||||
annotationInfo = _.merge(oldAnnotation.annotationInfo, annotationInfo)
|
||||
annotationInfo = defaultsDeep(annotationInfo, oldAnnotation.annotationInfo);
|
||||
}
|
||||
|
||||
const modifier = {
|
||||
|
@ -2,19 +2,19 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import fs from 'fs';
|
||||
import YAML from 'yaml';
|
||||
import _ from 'lodash';
|
||||
import { defaultsDeep } from '/imports/utils/array-utils';
|
||||
|
||||
const DEFAULT_SETTINGS_FILE_PATH = process.env.BBB_HTML5_SETTINGS || 'assets/app/config/settings.yml';
|
||||
const LOCAL_SETTINGS_FILE_PATH = process.env.BBB_HTML5_LOCAL_SETTINGS || '/etc/bigbluebutton/bbb-html5.yml';
|
||||
|
||||
try {
|
||||
if (fs.existsSync(DEFAULT_SETTINGS_FILE_PATH)) {
|
||||
const SETTINGS = YAML.parse(fs.readFileSync(DEFAULT_SETTINGS_FILE_PATH, 'utf-8'));
|
||||
let SETTINGS = YAML.parse(fs.readFileSync(DEFAULT_SETTINGS_FILE_PATH, 'utf-8'));
|
||||
|
||||
if (fs.existsSync(LOCAL_SETTINGS_FILE_PATH)) {
|
||||
console.log('Local configuration found! Merging with default configuration...');
|
||||
const LOCAL_CONFIG = YAML.parse(fs.readFileSync(LOCAL_SETTINGS_FILE_PATH, 'utf-8'));
|
||||
_.mergeWith(SETTINGS, LOCAL_CONFIG, (a, b) => (Array. isArray(b) ? b : undefined));
|
||||
SETTINGS = defaultsDeep(SETTINGS, LOCAL_CONFIG);
|
||||
} else console.log('Local Configuration not found! Loading default configuration...');
|
||||
|
||||
Meteor.settings = SETTINGS;
|
||||
|
Loading…
Reference in New Issue
Block a user