mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 22:02:11 +03:00
36 lines
979 B
JavaScript
36 lines
979 B
JavaScript
|
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});
|
||
|
|
||
|
const labsSetting = {};
|
||
|
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)});
|
||
|
}
|