This commit is contained in:
Michael Shanks 2019-10-11 18:44:55 +01:00
parent 2c2fefe0ea
commit 0a948fc75c
5 changed files with 9 additions and 9 deletions

View File

@ -64,7 +64,7 @@ const createDevConfig = async (opts) => {
const initialiseDatabase = async (opts) => {
const appContext = await getAppContext();
const appContext = await getAppContext({masterIsCreated:false});
await createMasterDb(
appContext,

View File

@ -12,7 +12,7 @@ module.exports = ({name}) => {
}
const run = async (opts) => {
const context = await getAppContext(opts.config);
const context = await getAppContext({configName:opts.config, masterIsCreated:true});
const bb = await getMasterApisWithFullAccess(context);
const app = bb.recordApi.getNew("/applications", "application");

View File

@ -2,8 +2,9 @@ const { getAppContext } = require("../../common");
const app = require("@budibase/server/app");
module.exports = ({config}) => {
getAppContext(config).then(context => {
app(context)
getAppContext({configName:config, masterIsCreated:true})
.then(context => {
app(context);
});
}

View File

@ -10,7 +10,7 @@ module.exports.serverFileName = relativePath =>
"server",
relativePath);
module.exports.getAppContext = async (configName) => {
module.exports.getAppContext = async ({configName, masterIsCreated}) => {
if(configName) {
if(!configName.endsWith(".js")) {
@ -21,5 +21,5 @@ module.exports.getAppContext = async (configName) => {
}
const config = require(join(cwd(), configName))();
return await buildAppContext(config, false);
return await buildAppContext(config, masterIsCreated);
}

View File

@ -6,7 +6,7 @@ const {
const getDatastore = require("./datastore");
const getDatabaseManager = require("./databaseManager");
const {$, splitKey} = require("@budibase/core").common;
const { keyBy, last, filter } = require("lodash/fp");
const { keyBy, values } = require("lodash/fp");
const {
masterAppPackage,
applictionVersionPackage,
@ -34,7 +34,6 @@ module.exports = async (context) => {
const loadApplications = async () => {
const apps = await bb.indexApi.listItems("/all_applications");
applications = $(apps, [
filter(a => !!a.defaultVersion.key),
keyBy("name")
]);
}
@ -286,7 +285,7 @@ module.exports = async (context) => {
await bb.recordApi.save(userInMaster);
}
const listApplications = () => applications;
const listApplications = () => values(applications);
return ({