Merge branch 'master' of github.com:Budibase/budibase into develop
This commit is contained in:
commit
d535afa542
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.0.173-alpha.0",
|
"version": "1.0.175",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/backend-core",
|
"name": "@budibase/backend-core",
|
||||||
"version": "1.0.173-alpha.0",
|
"version": "1.0.175",
|
||||||
"description": "Budibase backend core libraries used in server and worker",
|
"description": "Budibase backend core libraries used in server and worker",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
|
|
|
@ -29,7 +29,7 @@ passport.deserializeUser(async (user, done) => {
|
||||||
const user = await db.get(user._id)
|
const user = await db.get(user._id)
|
||||||
return done(null, user)
|
return done(null, user)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("User not found", err)
|
console.error(`User not found`, err)
|
||||||
return done(null, false, { message: "User not found" })
|
return done(null, false, { message: "User not found" })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -73,7 +73,7 @@ exports.isMultiTenant = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// used for automations, API endpoints should always be in context already
|
// used for automations, API endpoints should always be in context already
|
||||||
exports.doInTenant = (tenantId, task) => {
|
exports.doInTenant = (tenantId, task, { forceNew } = {}) => {
|
||||||
// the internal function is so that we can re-use an existing
|
// the internal function is so that we can re-use an existing
|
||||||
// context - don't want to close DB on a parent context
|
// context - don't want to close DB on a parent context
|
||||||
async function internal(opts = { existing: false }) {
|
async function internal(opts = { existing: false }) {
|
||||||
|
@ -98,7 +98,11 @@ exports.doInTenant = (tenantId, task) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const using = cls.getFromContext(ContextKeys.IN_USE)
|
const using = cls.getFromContext(ContextKeys.IN_USE)
|
||||||
if (using && cls.getFromContext(ContextKeys.TENANT_ID) === tenantId) {
|
if (
|
||||||
|
!forceNew &&
|
||||||
|
using &&
|
||||||
|
cls.getFromContext(ContextKeys.TENANT_ID) === tenantId
|
||||||
|
) {
|
||||||
cls.setOnContext(ContextKeys.IN_USE, using + 1)
|
cls.setOnContext(ContextKeys.IN_USE, using + 1)
|
||||||
return internal({ existing: true })
|
return internal({ existing: true })
|
||||||
} else {
|
} else {
|
||||||
|
@ -135,7 +139,7 @@ const setAppTenantId = appId => {
|
||||||
exports.updateTenantId(appTenantId)
|
exports.updateTenantId(appTenantId)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.doInAppContext = (appId, task) => {
|
exports.doInAppContext = (appId, task, { forceNew } = {}) => {
|
||||||
if (!appId) {
|
if (!appId) {
|
||||||
throw new Error("appId is required")
|
throw new Error("appId is required")
|
||||||
}
|
}
|
||||||
|
@ -162,7 +166,7 @@ exports.doInAppContext = (appId, task) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const using = cls.getFromContext(ContextKeys.IN_USE)
|
const using = cls.getFromContext(ContextKeys.IN_USE)
|
||||||
if (using && cls.getFromContext(ContextKeys.APP_ID) === appId) {
|
if (!forceNew && using && cls.getFromContext(ContextKeys.APP_ID) === appId) {
|
||||||
cls.setOnContext(ContextKeys.IN_USE, using + 1)
|
cls.setOnContext(ContextKeys.IN_USE, using + 1)
|
||||||
return internal({ existing: true })
|
return internal({ existing: true })
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -30,7 +30,7 @@ exports.authenticate = async function (ctx, email, password, done) {
|
||||||
|
|
||||||
const dbUser = await getGlobalUserByEmail(email)
|
const dbUser = await getGlobalUserByEmail(email)
|
||||||
if (dbUser == null) {
|
if (dbUser == null) {
|
||||||
return authError(done, "User not found")
|
return authError(done, `User not found: [${email}]`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// check that the user is currently inactive, if this is the case throw invalid
|
// check that the user is currently inactive, if this is the case throw invalid
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/bbui",
|
"name": "@budibase/bbui",
|
||||||
"description": "A UI solution used in the different Budibase projects.",
|
"description": "A UI solution used in the different Budibase projects.",
|
||||||
"version": "1.0.173-alpha.0",
|
"version": "1.0.175",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"svelte": "src/index.js",
|
"svelte": "src/index.js",
|
||||||
"module": "dist/bbui.es.js",
|
"module": "dist/bbui.es.js",
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@adobe/spectrum-css-workflow-icons": "^1.2.1",
|
"@adobe/spectrum-css-workflow-icons": "^1.2.1",
|
||||||
"@budibase/string-templates": "^1.0.173-alpha.0",
|
"@budibase/string-templates": "^1.0.175",
|
||||||
"@spectrum-css/actionbutton": "^1.0.1",
|
"@spectrum-css/actionbutton": "^1.0.1",
|
||||||
"@spectrum-css/actiongroup": "^1.0.1",
|
"@spectrum-css/actiongroup": "^1.0.1",
|
||||||
"@spectrum-css/avatar": "^3.0.2",
|
"@spectrum-css/avatar": "^3.0.2",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/builder",
|
"name": "@budibase/builder",
|
||||||
"version": "1.0.173-alpha.0",
|
"version": "1.0.175",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -69,10 +69,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^1.0.173-alpha.0",
|
"@budibase/bbui": "^1.0.175",
|
||||||
"@budibase/client": "^1.0.173-alpha.0",
|
"@budibase/client": "^1.0.175",
|
||||||
"@budibase/frontend-core": "^1.0.173-alpha.0",
|
"@budibase/frontend-core": "^1.0.175",
|
||||||
"@budibase/string-templates": "^1.0.173-alpha.0",
|
"@budibase/string-templates": "^1.0.175",
|
||||||
"@sentry/browser": "5.19.1",
|
"@sentry/browser": "5.19.1",
|
||||||
"@spectrum-css/page": "^3.0.1",
|
"@spectrum-css/page": "^3.0.1",
|
||||||
"@spectrum-css/vars": "^3.0.1",
|
"@spectrum-css/vars": "^3.0.1",
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
async function login() {
|
async function login() {
|
||||||
try {
|
try {
|
||||||
await auth.login({
|
await auth.login({
|
||||||
username,
|
username: username.trim(),
|
||||||
password,
|
password,
|
||||||
})
|
})
|
||||||
if ($auth?.user?.forceResetPassword) {
|
if ($auth?.user?.forceResetPassword) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/cli",
|
"name": "@budibase/cli",
|
||||||
"version": "1.0.173-alpha.0",
|
"version": "1.0.175",
|
||||||
"description": "Budibase CLI, for developers, self hosting and migrations.",
|
"description": "Budibase CLI, for developers, self hosting and migrations.",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/client",
|
"name": "@budibase/client",
|
||||||
"version": "1.0.173-alpha.0",
|
"version": "1.0.175",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"module": "dist/budibase-client.js",
|
"module": "dist/budibase-client.js",
|
||||||
"main": "dist/budibase-client.js",
|
"main": "dist/budibase-client.js",
|
||||||
|
@ -19,9 +19,9 @@
|
||||||
"dev:builder": "rollup -cw"
|
"dev:builder": "rollup -cw"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^1.0.173-alpha.0",
|
"@budibase/bbui": "^1.0.175",
|
||||||
"@budibase/frontend-core": "^1.0.173-alpha.0",
|
"@budibase/frontend-core": "^1.0.175",
|
||||||
"@budibase/string-templates": "^1.0.173-alpha.0",
|
"@budibase/string-templates": "^1.0.175",
|
||||||
"@spectrum-css/button": "^3.0.3",
|
"@spectrum-css/button": "^3.0.3",
|
||||||
"@spectrum-css/card": "^3.0.3",
|
"@spectrum-css/card": "^3.0.3",
|
||||||
"@spectrum-css/divider": "^1.0.3",
|
"@spectrum-css/divider": "^1.0.3",
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/frontend-core",
|
"name": "@budibase/frontend-core",
|
||||||
"version": "1.0.173-alpha.0",
|
"version": "1.0.175",
|
||||||
"description": "Budibase frontend core libraries used in builder and client",
|
"description": "Budibase frontend core libraries used in builder and client",
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"svelte": "src/index.js",
|
"svelte": "src/index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^1.0.173-alpha.0",
|
"@budibase/bbui": "^1.0.175",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"svelte": "^3.46.2"
|
"svelte": "^3.46.2"
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ ENV BUDIBASE_ENVIRONMENT=PRODUCTION
|
||||||
# copy files and install dependencies
|
# copy files and install dependencies
|
||||||
COPY . ./
|
COPY . ./
|
||||||
RUN yarn
|
RUN yarn
|
||||||
|
RUN yarn global add pm2
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
|
||||||
# Install client for oracle datasource
|
# Install client for oracle datasource
|
||||||
|
@ -28,4 +29,5 @@ EXPOSE 4001
|
||||||
# due to this causing yarn to stop installing dev dependencies
|
# due to this causing yarn to stop installing dev dependencies
|
||||||
# which are actually needed to get this environment up and running
|
# which are actually needed to get this environment up and running
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
CMD ["yarn", "run:docker"]
|
ENV CLUSTER_MODE=${CLUSTER_MODE}
|
||||||
|
CMD ["./docker_run.sh"]
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
if [ -z $CLUSTER_MODE ]; then
|
||||||
|
yarn run:docker
|
||||||
|
else
|
||||||
|
yarn run:docker:cluster
|
||||||
|
fi
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/server",
|
"name": "@budibase/server",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "1.0.173-alpha.0",
|
"version": "1.0.175",
|
||||||
"description": "Budibase Web Server",
|
"description": "Budibase Web Server",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -18,6 +18,7 @@
|
||||||
"build:docker": "yarn run predocker && docker build . -t app-service --label version=$BUDIBASE_RELEASE_VERSION",
|
"build:docker": "yarn run predocker && docker build . -t app-service --label version=$BUDIBASE_RELEASE_VERSION",
|
||||||
"build:docs": "node ./scripts/docs/generate.js open",
|
"build:docs": "node ./scripts/docs/generate.js open",
|
||||||
"run:docker": "node dist/index.js",
|
"run:docker": "node dist/index.js",
|
||||||
|
"run:docker:cluster": "pm2-runtime start pm2.config.js",
|
||||||
"dev:stack:up": "node scripts/dev/manage.js up",
|
"dev:stack:up": "node scripts/dev/manage.js up",
|
||||||
"dev:stack:down": "node scripts/dev/manage.js down",
|
"dev:stack:down": "node scripts/dev/manage.js down",
|
||||||
"dev:stack:nuke": "node scripts/dev/manage.js nuke",
|
"dev:stack:nuke": "node scripts/dev/manage.js nuke",
|
||||||
|
@ -69,10 +70,10 @@
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apidevtools/swagger-parser": "^10.0.3",
|
"@apidevtools/swagger-parser": "^10.0.3",
|
||||||
"@budibase/backend-core": "^1.0.173-alpha.0",
|
"@budibase/backend-core": "^1.0.175",
|
||||||
"@budibase/client": "^1.0.173-alpha.0",
|
"@budibase/client": "^1.0.175",
|
||||||
"@budibase/pro": "1.0.173-alpha.0",
|
"@budibase/pro": "1.0.175",
|
||||||
"@budibase/string-templates": "^1.0.173-alpha.0",
|
"@budibase/string-templates": "^1.0.175",
|
||||||
"@bull-board/api": "^3.7.0",
|
"@bull-board/api": "^3.7.0",
|
||||||
"@bull-board/koa": "^3.7.0",
|
"@bull-board/koa": "^3.7.0",
|
||||||
"@elastic/elasticsearch": "7.10.0",
|
"@elastic/elasticsearch": "7.10.0",
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
module.exports = {
|
||||||
|
apps: [
|
||||||
|
{
|
||||||
|
script: "dist/index.js",
|
||||||
|
instances: "max",
|
||||||
|
exec_mode: "cluster",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
|
@ -1014,10 +1014,10 @@
|
||||||
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
||||||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||||
|
|
||||||
"@budibase/backend-core@1.0.167-alpha.3":
|
"@budibase/backend-core@1.0.175":
|
||||||
version "1.0.167-alpha.3"
|
version "1.0.175"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.167-alpha.3.tgz#bb82ba4bbd6aaca47ceb97cb97047f4f615fd9a9"
|
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.175.tgz#9c8f71c00d3cde510c3b6843302700a9249969db"
|
||||||
integrity sha512-sETe50Nid+uuwg0/liEjhy9/o9ygjrYSOJJf1CzuC8xW1ni9wHMMrPx3vsHxYs21aE1+nW1hNgkCUw5kpw7Kjg==
|
integrity sha512-ZzIzNyiW6W8YPVTxsAQnaDEmVUtW22Bna8uJ9BEal/0u8JvYpvWnbPmpbrX7nadJ+5zIGJPxxpe97rhsHJeuaA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@techpass/passport-openidconnect" "^0.3.0"
|
"@techpass/passport-openidconnect" "^0.3.0"
|
||||||
aws-sdk "^2.901.0"
|
aws-sdk "^2.901.0"
|
||||||
|
@ -1091,12 +1091,12 @@
|
||||||
svelte-flatpickr "^3.2.3"
|
svelte-flatpickr "^3.2.3"
|
||||||
svelte-portal "^1.0.0"
|
svelte-portal "^1.0.0"
|
||||||
|
|
||||||
"@budibase/pro@1.0.167-alpha.3":
|
"@budibase/pro@1.0.175":
|
||||||
version "1.0.167-alpha.3"
|
version "1.0.175"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.167-alpha.3.tgz#22fa274ffbd50e08dfe5ca4bb546f14d68ba02d4"
|
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.175.tgz#1d8ddc698ad17e2f5d73b1ab741c6641da4bda47"
|
||||||
integrity sha512-y6bQmNxRRChGJUVRu/FEUdkBlYZlGpxMC8xBSd8oj1FDRdTofbL0it2XUEI3P8H5zBM0J33pw6x27dlWnrOItg==
|
integrity sha512-iGqOtsXeO5bHcg4IJjg8NwOK5bNjI3TnJCr7PtcTjlLyZyCyj+onL2GTk3A6X+d1ZKSQKy9bl3Q+hIsdbZ9GIg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@budibase/backend-core" "1.0.167-alpha.3"
|
"@budibase/backend-core" "1.0.175"
|
||||||
node-fetch "^2.6.1"
|
node-fetch "^2.6.1"
|
||||||
|
|
||||||
"@budibase/standard-components@^0.9.139":
|
"@budibase/standard-components@^0.9.139":
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/string-templates",
|
"name": "@budibase/string-templates",
|
||||||
"version": "1.0.173-alpha.0",
|
"version": "1.0.175",
|
||||||
"description": "Handlebars wrapper for Budibase templating.",
|
"description": "Handlebars wrapper for Budibase templating.",
|
||||||
"main": "src/index.cjs",
|
"main": "src/index.cjs",
|
||||||
"module": "dist/bundle.mjs",
|
"module": "dist/bundle.mjs",
|
||||||
|
|
|
@ -10,6 +10,7 @@ WORKDIR /app
|
||||||
# copy files and install dependencies
|
# copy files and install dependencies
|
||||||
COPY . ./
|
COPY . ./
|
||||||
RUN yarn
|
RUN yarn
|
||||||
|
RUN yarn global add pm2
|
||||||
|
|
||||||
EXPOSE 4001
|
EXPOSE 4001
|
||||||
|
|
||||||
|
@ -17,4 +18,5 @@ EXPOSE 4001
|
||||||
# due to this causing yarn to stop installing dev dependencies
|
# due to this causing yarn to stop installing dev dependencies
|
||||||
# which are actually needed to get this environment up and running
|
# which are actually needed to get this environment up and running
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
CMD ["yarn", "run:docker"]
|
ENV CLUSTER_MODE=${CLUSTER_MODE}
|
||||||
|
CMD ["./docker_run.sh"]
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
if [[ -z $CLUSTER_MODE ]]; then
|
||||||
|
yarn run:docker
|
||||||
|
else
|
||||||
|
yarn run:docker:cluster
|
||||||
|
fi
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/worker",
|
"name": "@budibase/worker",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "1.0.173-alpha.0",
|
"version": "1.0.175",
|
||||||
"description": "Budibase background service",
|
"description": "Budibase background service",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -15,6 +15,7 @@
|
||||||
"build": "rimraf dist/ && tsc",
|
"build": "rimraf dist/ && tsc",
|
||||||
"postbuild": "copyfiles -u 1 src/**/*.hbs dist/",
|
"postbuild": "copyfiles -u 1 src/**/*.hbs dist/",
|
||||||
"run:docker": "node dist/index.js",
|
"run:docker": "node dist/index.js",
|
||||||
|
"run:docker:cluster": "pm2-runtime start pm2.config.js",
|
||||||
"build:docker": "docker build . -t worker-service --label version=$BUDIBASE_RELEASE_VERSION",
|
"build:docker": "docker build . -t worker-service --label version=$BUDIBASE_RELEASE_VERSION",
|
||||||
"dev:stack:init": "node ./scripts/dev/manage.js init",
|
"dev:stack:init": "node ./scripts/dev/manage.js init",
|
||||||
"dev:builder": "npm run dev:stack:init && nodemon",
|
"dev:builder": "npm run dev:stack:init && nodemon",
|
||||||
|
@ -31,9 +32,9 @@
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/backend-core": "^1.0.173-alpha.0",
|
"@budibase/backend-core": "^1.0.175",
|
||||||
"@budibase/pro": "1.0.173-alpha.0",
|
"@budibase/pro": "1.0.175",
|
||||||
"@budibase/string-templates": "^1.0.173-alpha.0",
|
"@budibase/string-templates": "^1.0.175",
|
||||||
"@koa/router": "^8.0.0",
|
"@koa/router": "^8.0.0",
|
||||||
"@sentry/node": "6.17.7",
|
"@sentry/node": "6.17.7",
|
||||||
"@techpass/passport-openidconnect": "^0.3.0",
|
"@techpass/passport-openidconnect": "^0.3.0",
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
module.exports = {
|
||||||
|
apps: [
|
||||||
|
{
|
||||||
|
script: "./dist/index.js",
|
||||||
|
instances: "max",
|
||||||
|
exec_mode: "cluster",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
|
@ -17,7 +17,6 @@ const { googleCallbackUrl, oidcCallbackUrl } = require("./auth")
|
||||||
const {
|
const {
|
||||||
withCache,
|
withCache,
|
||||||
CacheKeys,
|
CacheKeys,
|
||||||
TTL,
|
|
||||||
bustCache,
|
bustCache,
|
||||||
} = require("@budibase/backend-core/cache")
|
} = require("@budibase/backend-core/cache")
|
||||||
|
|
||||||
|
@ -256,58 +255,62 @@ exports.configChecklist = async function (ctx) {
|
||||||
const tenantId = getTenantId()
|
const tenantId = getTenantId()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ctx.body = await withCache(CacheKeys.CHECKLIST, TTL.ONE_HOUR, async () => {
|
ctx.body = await withCache(
|
||||||
let apps = []
|
CacheKeys.CHECKLIST,
|
||||||
if (!env.MULTI_TENANCY || tenantId) {
|
env.CHECKLIST_CACHE_TTL,
|
||||||
// Apps exist
|
async () => {
|
||||||
apps = await getAllApps({ idsOnly: true, efficient: true })
|
let apps = []
|
||||||
}
|
if (!env.MULTI_TENANCY || tenantId) {
|
||||||
|
// Apps exist
|
||||||
|
apps = await getAllApps({ idsOnly: true, efficient: true })
|
||||||
|
}
|
||||||
|
|
||||||
// They have set up SMTP
|
// They have set up SMTP
|
||||||
const smtpConfig = await getScopedFullConfig(db, {
|
const smtpConfig = await getScopedFullConfig(db, {
|
||||||
type: Configs.SMTP,
|
type: Configs.SMTP,
|
||||||
})
|
|
||||||
|
|
||||||
// They have set up Google Auth
|
|
||||||
const googleConfig = await getScopedFullConfig(db, {
|
|
||||||
type: Configs.GOOGLE,
|
|
||||||
})
|
|
||||||
|
|
||||||
// They have set up OIDC
|
|
||||||
const oidcConfig = await getScopedFullConfig(db, {
|
|
||||||
type: Configs.OIDC,
|
|
||||||
})
|
|
||||||
|
|
||||||
// They have set up an global user
|
|
||||||
const users = await db.allDocs(
|
|
||||||
getGlobalUserParams(null, {
|
|
||||||
include_docs: true,
|
|
||||||
limit: 1,
|
|
||||||
})
|
})
|
||||||
)
|
|
||||||
return {
|
// They have set up Google Auth
|
||||||
apps: {
|
const googleConfig = await getScopedFullConfig(db, {
|
||||||
checked: apps.length > 0,
|
type: Configs.GOOGLE,
|
||||||
label: "Create your first app",
|
})
|
||||||
link: "/builder/portal/apps",
|
|
||||||
},
|
// They have set up OIDC
|
||||||
smtp: {
|
const oidcConfig = await getScopedFullConfig(db, {
|
||||||
checked: !!smtpConfig,
|
type: Configs.OIDC,
|
||||||
label: "Set up email",
|
})
|
||||||
link: "/builder/portal/manage/email",
|
|
||||||
},
|
// They have set up an global user
|
||||||
adminUser: {
|
const users = await db.allDocs(
|
||||||
checked: users && users.rows.length >= 1,
|
getGlobalUserParams(null, {
|
||||||
label: "Create your first user",
|
include_docs: true,
|
||||||
link: "/builder/portal/manage/users",
|
limit: 1,
|
||||||
},
|
})
|
||||||
sso: {
|
)
|
||||||
checked: !!googleConfig || !!oidcConfig,
|
return {
|
||||||
label: "Set up single sign-on",
|
apps: {
|
||||||
link: "/builder/portal/manage/auth",
|
checked: apps.length > 0,
|
||||||
},
|
label: "Create your first app",
|
||||||
|
link: "/builder/portal/apps",
|
||||||
|
},
|
||||||
|
smtp: {
|
||||||
|
checked: !!smtpConfig,
|
||||||
|
label: "Set up email",
|
||||||
|
link: "/builder/portal/manage/email",
|
||||||
|
},
|
||||||
|
adminUser: {
|
||||||
|
checked: users && users.rows.length >= 1,
|
||||||
|
label: "Create your first user",
|
||||||
|
link: "/builder/portal/manage/users",
|
||||||
|
},
|
||||||
|
sso: {
|
||||||
|
checked: !!googleConfig || !!oidcConfig,
|
||||||
|
label: "Set up single sign-on",
|
||||||
|
link: "/builder/portal/manage/auth",
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ctx.throw(err.status, err)
|
ctx.throw(err.status, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,12 @@ if (!LOADED && isDev() && !isTest()) {
|
||||||
LOADED = true
|
LOADED = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseIntSafe(number) {
|
||||||
|
if (number) {
|
||||||
|
return parseInt(number)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// auth
|
// auth
|
||||||
MINIO_ACCESS_KEY: process.env.MINIO_ACCESS_KEY,
|
MINIO_ACCESS_KEY: process.env.MINIO_ACCESS_KEY,
|
||||||
|
@ -53,6 +59,8 @@ module.exports = {
|
||||||
SMTP_HOST: process.env.SMTP_HOST,
|
SMTP_HOST: process.env.SMTP_HOST,
|
||||||
SMTP_PORT: process.env.SMTP_PORT,
|
SMTP_PORT: process.env.SMTP_PORT,
|
||||||
SMTP_FROM_ADDRESS: process.env.SMTP_FROM_ADDRESS,
|
SMTP_FROM_ADDRESS: process.env.SMTP_FROM_ADDRESS,
|
||||||
|
// other
|
||||||
|
CHECKLIST_CACHE_TTL: parseIntSafe(process.env.CHECKLIST_CACHE_TTL) || 3600,
|
||||||
_set(key, value) {
|
_set(key, value) {
|
||||||
process.env[key] = value
|
process.env[key] = value
|
||||||
module.exports[key] = value
|
module.exports[key] = value
|
||||||
|
|
|
@ -293,10 +293,10 @@
|
||||||
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
||||||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||||
|
|
||||||
"@budibase/backend-core@1.0.167-alpha.3":
|
"@budibase/backend-core@1.0.175":
|
||||||
version "1.0.167-alpha.3"
|
version "1.0.175"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.167-alpha.3.tgz#bb82ba4bbd6aaca47ceb97cb97047f4f615fd9a9"
|
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.175.tgz#9c8f71c00d3cde510c3b6843302700a9249969db"
|
||||||
integrity sha512-sETe50Nid+uuwg0/liEjhy9/o9ygjrYSOJJf1CzuC8xW1ni9wHMMrPx3vsHxYs21aE1+nW1hNgkCUw5kpw7Kjg==
|
integrity sha512-ZzIzNyiW6W8YPVTxsAQnaDEmVUtW22Bna8uJ9BEal/0u8JvYpvWnbPmpbrX7nadJ+5zIGJPxxpe97rhsHJeuaA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@techpass/passport-openidconnect" "^0.3.0"
|
"@techpass/passport-openidconnect" "^0.3.0"
|
||||||
aws-sdk "^2.901.0"
|
aws-sdk "^2.901.0"
|
||||||
|
@ -321,12 +321,12 @@
|
||||||
uuid "^8.3.2"
|
uuid "^8.3.2"
|
||||||
zlib "^1.0.5"
|
zlib "^1.0.5"
|
||||||
|
|
||||||
"@budibase/pro@1.0.167-alpha.3":
|
"@budibase/pro@1.0.175":
|
||||||
version "1.0.167-alpha.3"
|
version "1.0.175"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.167-alpha.3.tgz#22fa274ffbd50e08dfe5ca4bb546f14d68ba02d4"
|
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.175.tgz#1d8ddc698ad17e2f5d73b1ab741c6641da4bda47"
|
||||||
integrity sha512-y6bQmNxRRChGJUVRu/FEUdkBlYZlGpxMC8xBSd8oj1FDRdTofbL0it2XUEI3P8H5zBM0J33pw6x27dlWnrOItg==
|
integrity sha512-iGqOtsXeO5bHcg4IJjg8NwOK5bNjI3TnJCr7PtcTjlLyZyCyj+onL2GTk3A6X+d1ZKSQKy9bl3Q+hIsdbZ9GIg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@budibase/backend-core" "1.0.167-alpha.3"
|
"@budibase/backend-core" "1.0.175"
|
||||||
node-fetch "^2.6.1"
|
node-fetch "^2.6.1"
|
||||||
|
|
||||||
"@cspotcode/source-map-consumer@0.8.0":
|
"@cspotcode/source-map-consumer@0.8.0":
|
||||||
|
|
Loading…
Reference in New Issue