cli...
This commit is contained in:
parent
2c2fefe0ea
commit
0a948fc75c
|
@ -64,7 +64,7 @@ const createDevConfig = async (opts) => {
|
||||||
|
|
||||||
const initialiseDatabase = async (opts) => {
|
const initialiseDatabase = async (opts) => {
|
||||||
|
|
||||||
const appContext = await getAppContext();
|
const appContext = await getAppContext({masterIsCreated:false});
|
||||||
|
|
||||||
await createMasterDb(
|
await createMasterDb(
|
||||||
appContext,
|
appContext,
|
||||||
|
|
|
@ -12,7 +12,7 @@ module.exports = ({name}) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const run = async (opts) => {
|
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 bb = await getMasterApisWithFullAccess(context);
|
||||||
|
|
||||||
const app = bb.recordApi.getNew("/applications", "application");
|
const app = bb.recordApi.getNew("/applications", "application");
|
||||||
|
|
|
@ -2,8 +2,9 @@ const { getAppContext } = require("../../common");
|
||||||
const app = require("@budibase/server/app");
|
const app = require("@budibase/server/app");
|
||||||
|
|
||||||
module.exports = ({config}) => {
|
module.exports = ({config}) => {
|
||||||
getAppContext(config).then(context => {
|
getAppContext({configName:config, masterIsCreated:true})
|
||||||
app(context)
|
.then(context => {
|
||||||
|
app(context);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ module.exports.serverFileName = relativePath =>
|
||||||
"server",
|
"server",
|
||||||
relativePath);
|
relativePath);
|
||||||
|
|
||||||
module.exports.getAppContext = async (configName) => {
|
module.exports.getAppContext = async ({configName, masterIsCreated}) => {
|
||||||
|
|
||||||
if(configName) {
|
if(configName) {
|
||||||
if(!configName.endsWith(".js")) {
|
if(!configName.endsWith(".js")) {
|
||||||
|
@ -21,5 +21,5 @@ module.exports.getAppContext = async (configName) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const config = require(join(cwd(), configName))();
|
const config = require(join(cwd(), configName))();
|
||||||
return await buildAppContext(config, false);
|
return await buildAppContext(config, masterIsCreated);
|
||||||
}
|
}
|
|
@ -6,7 +6,7 @@ const {
|
||||||
const getDatastore = require("./datastore");
|
const getDatastore = require("./datastore");
|
||||||
const getDatabaseManager = require("./databaseManager");
|
const getDatabaseManager = require("./databaseManager");
|
||||||
const {$, splitKey} = require("@budibase/core").common;
|
const {$, splitKey} = require("@budibase/core").common;
|
||||||
const { keyBy, last, filter } = require("lodash/fp");
|
const { keyBy, values } = require("lodash/fp");
|
||||||
const {
|
const {
|
||||||
masterAppPackage,
|
masterAppPackage,
|
||||||
applictionVersionPackage,
|
applictionVersionPackage,
|
||||||
|
@ -34,7 +34,6 @@ module.exports = async (context) => {
|
||||||
const loadApplications = async () => {
|
const loadApplications = async () => {
|
||||||
const apps = await bb.indexApi.listItems("/all_applications");
|
const apps = await bb.indexApi.listItems("/all_applications");
|
||||||
applications = $(apps, [
|
applications = $(apps, [
|
||||||
filter(a => !!a.defaultVersion.key),
|
|
||||||
keyBy("name")
|
keyBy("name")
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -286,7 +285,7 @@ module.exports = async (context) => {
|
||||||
await bb.recordApi.save(userInMaster);
|
await bb.recordApi.save(userInMaster);
|
||||||
}
|
}
|
||||||
|
|
||||||
const listApplications = () => applications;
|
const listApplications = () => values(applications);
|
||||||
|
|
||||||
|
|
||||||
return ({
|
return ({
|
||||||
|
|
Loading…
Reference in New Issue