2022-01-17 21:05:10 +03:00
|
|
|
export function enableLabsFlag(server, flag) {
|
|
|
|
if (!server.schema.configs.all().length) {
|
|
|
|
server.loadFixtures('configs');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!server.schema.settings.all().length) {
|
|
|
|
server.loadFixtures('settings');
|
|
|
|
}
|
|
|
|
|
|
|
|
const config = server.schema.configs.first();
|
|
|
|
config.update({enableDeveloperExperiments: true});
|
|
|
|
|
2022-02-19 01:36:01 +03:00
|
|
|
const existingSetting = server.db.settings.findBy({key: 'labs'}).value;
|
|
|
|
const labsSetting = existingSetting ? JSON.parse(existingSetting) : {};
|
2022-01-17 21:05:10 +03:00
|
|
|
labsSetting[flag] = true;
|
|
|
|
|
|
|
|
server.db.settings.update({key: 'labs'}, {value: JSON.stringify(labsSetting)});
|
|
|
|
}
|
|
|
|
|
|
|
|
export function disableLabsFlag(server, flag) {
|
|
|
|
if (!server.schema.configs.all().length) {
|
|
|
|
server.loadFixtures('configs');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!server.schema.settings.all().length) {
|
|
|
|
server.loadFixtures('settings');
|
|
|
|
}
|
|
|
|
|
|
|
|
const config = server.schema.configs.first();
|
|
|
|
config.update({enableDeveloperExperiments: true});
|
|
|
|
|
|
|
|
const labsSetting = {};
|
|
|
|
labsSetting[flag] = false;
|
|
|
|
|
|
|
|
server.db.settings.update({key: 'labs'}, {value: JSON.stringify(labsSetting)});
|
|
|
|
}
|