diff --git a/.github/workflows/deploy-preprod.yml b/.github/workflows/deploy-preprod.yml index 5b3282313c..10fadc36c5 100644 --- a/.github/workflows/deploy-preprod.yml +++ b/.github/workflows/deploy-preprod.yml @@ -38,7 +38,7 @@ jobs: wc -l values.preprod.yaml - name: Deploy to Preprod Environment - uses: deliverybot/helm@v1 + uses: glopezep/helm@v1.7.1 with: release: budibase-preprod namespace: budibase diff --git a/charts/budibase/templates/worker-service-deployment.yaml b/charts/budibase/templates/worker-service-deployment.yaml index 8b6f5564ad..b6c757cb9f 100644 --- a/charts/budibase/templates/worker-service-deployment.yaml +++ b/charts/budibase/templates/worker-service-deployment.yaml @@ -111,6 +111,10 @@ spec: value: {{ .Values.globals.smtp.from | quote }} - name: APPS_URL value: http://app-service:{{ .Values.services.apps.port }} + - name: GOOGLE_CLIENT_ID + value: {{ .Values.globals.google.clientId | quote }} + - name: GOOGLE_CLIENT_SECRET + value: {{ .Values.globals.google.secret | quote }} image: budibase/worker:{{ .Values.globals.appVersion }} imagePullPolicy: Always name: bbworker diff --git a/lerna.json b/lerna.json index a2955c907f..832eb90564 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.0.50-alpha.7", + "version": "1.0.57", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 943a02bb2f..a53a132f31 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.0.50-alpha.7", + "version": "1.0.57", "description": "Budibase backend core libraries used in server and worker", "main": "src/index.js", "author": "Budibase", diff --git a/packages/backend-core/src/environment.js b/packages/backend-core/src/environment.js index c26ad1c199..d112ad8599 100644 --- a/packages/backend-core/src/environment.js +++ b/packages/backend-core/src/environment.js @@ -11,6 +11,8 @@ module.exports = { COUCH_DB_URL: process.env.COUCH_DB_URL, COUCH_DB_USERNAME: process.env.COUCH_DB_USER, COUCH_DB_PASSWORD: process.env.COUCH_DB_PASSWORD, + GOOGLE_CLIENT_ID: process.env.GOOGLE_CLIENT_ID, + GOOGLE_CLIENT_SECRET: process.env.GOOGLE_CLIENT_SECRET, SALT_ROUNDS: process.env.SALT_ROUNDS, REDIS_URL: process.env.REDIS_URL, REDIS_PASSWORD: process.env.REDIS_PASSWORD, diff --git a/packages/backend-core/src/middleware/passport/datasource/google.js b/packages/backend-core/src/middleware/passport/datasource/google.js index bfc2e4a61e..c7553cee50 100644 --- a/packages/backend-core/src/middleware/passport/datasource/google.js +++ b/packages/backend-core/src/middleware/passport/datasource/google.js @@ -1,22 +1,17 @@ -const { getScopedConfig } = require("../../../db/utils") -const { getGlobalDB } = require("../../../tenancy") const google = require("../google") -const { Configs, Cookies } = require("../../../constants") +const { Cookies } = require("../../../constants") const { clearCookie, getCookie } = require("../../../utils") const { getDB } = require("../../../db") +const environment = require("../../../environment") async function preAuth(passport, ctx, next) { - const db = getGlobalDB() // get the relevant config - const config = await getScopedConfig(db, { - type: Configs.GOOGLE, - workspace: ctx.query.workspace, - }) - const publicConfig = await getScopedConfig(db, { - type: Configs.SETTINGS, - }) - let callbackUrl = `${publicConfig.platformUrl}/api/global/auth/datasource/google/callback` - const strategy = await google.strategyFactory(config, callbackUrl) + const googleConfig = { + clientID: environment.GOOGLE_CLIENT_ID, + clientSecret: environment.GOOGLE_CLIENT_SECRET, + } + let callbackUrl = `${environment.PLATFORM_URL}/api/global/auth/datasource/google/callback` + const strategy = await google.strategyFactory(googleConfig, callbackUrl) if (!ctx.query.appId || !ctx.query.datasourceId) { ctx.throw(400, "appId and datasourceId query params not present.") @@ -30,18 +25,13 @@ async function preAuth(passport, ctx, next) { } async function postAuth(passport, ctx, next) { - const db = getGlobalDB() + // get the relevant config + const config = { + clientID: environment.GOOGLE_CLIENT_ID, + clientSecret: environment.GOOGLE_CLIENT_SECRET, + } - const config = await getScopedConfig(db, { - type: Configs.GOOGLE, - workspace: ctx.query.workspace, - }) - - const publicConfig = await getScopedConfig(db, { - type: Configs.SETTINGS, - }) - - let callbackUrl = `${publicConfig.platformUrl}/api/global/auth/datasource/google/callback` + let callbackUrl = `${environment.PLATFORM_URL}/api/global/auth/datasource/google/callback` const strategy = await google.strategyFactory( config, callbackUrl, diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 41e6eaeb17..fe4ee39617 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "1.0.50-alpha.7", + "version": "1.0.57", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", diff --git a/packages/builder/package.json b/packages/builder/package.json index 416f6113d4..e1b8b9f114 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.0.50-alpha.7", + "version": "1.0.57", "license": "GPL-3.0", "private": true, "scripts": { @@ -64,10 +64,10 @@ } }, "dependencies": { - "@budibase/bbui": "^1.0.50-alpha.7", - "@budibase/client": "^1.0.50-alpha.7", + "@budibase/bbui": "^1.0.57", + "@budibase/client": "^1.0.57", "@budibase/frontend-core": "^1.0.50-alpha.7", - "@budibase/string-templates": "^1.0.50-alpha.7", + "@budibase/string-templates": "^1.0.57", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/builder/src/components/backend/DatasourceNavigator/_components/GoogleButton.svelte b/packages/builder/src/components/backend/DatasourceNavigator/_components/GoogleButton.svelte index 091e332832..642aa548f2 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/_components/GoogleButton.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/_components/GoogleButton.svelte @@ -17,7 +17,7 @@ ds = await preAuthStep() } window.open( - `/api/global/auth/${tenantId}/datasource/google?datasourceId=${datasource._id}&appId=${$store.appId}`, + `/api/global/auth/${tenantId}/datasource/google?datasourceId=${ds._id}&appId=${$store.appId}`, "_blank" ) }} diff --git a/packages/cli/package.json b/packages/cli/package.json index 62e1654c82..17360baeb1 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.0.50-alpha.7", + "version": "1.0.57", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index bc0d8812f7..8d2a1ca768 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.0.50-alpha.7", + "version": "1.0.57", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^1.0.50-alpha.7", + "@budibase/bbui": "^1.0.57", "@budibase/frontend-core": "^1.0.50-alpha.7", - "@budibase/string-templates": "^1.0.50-alpha.7", + "@budibase/string-templates": "^1.0.57", "regexparam": "^1.3.0", "rollup-plugin-polyfill-node": "^0.8.0", "shortid": "^2.2.15", diff --git a/packages/server/package.json b/packages/server/package.json index a21e01027b..c939b23291 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.0.50-alpha.7", + "version": "1.0.57", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -70,9 +70,9 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "^10.0.3", - "@budibase/backend-core": "^1.0.50-alpha.7", - "@budibase/client": "^1.0.50-alpha.7", - "@budibase/string-templates": "^1.0.50-alpha.7", + "@budibase/backend-core": "^1.0.57", + "@budibase/client": "^1.0.57", + "@budibase/string-templates": "^1.0.57", "@bull-board/api": "^3.7.0", "@bull-board/koa": "^3.7.0", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/server/src/api/controllers/integration.js b/packages/server/src/api/controllers/integration.js index f1aafe7e45..75fd9ce80e 100644 --- a/packages/server/src/api/controllers/integration.js +++ b/packages/server/src/api/controllers/integration.js @@ -1,7 +1,6 @@ const { definitions } = require("../../integrations") exports.fetch = async function (ctx) { - // TODO: fetch these from a github repo etc ctx.status = 200 ctx.body = definitions } diff --git a/packages/server/src/integrations/index.ts b/packages/server/src/integrations/index.ts index 4679e658b6..00b00c25fb 100644 --- a/packages/server/src/integrations/index.ts +++ b/packages/server/src/integrations/index.ts @@ -11,6 +11,7 @@ const arangodb = require("./arangodb") const rest = require("./rest") const googlesheets = require("./googlesheets") const { SourceNames } = require("../definitions/datasource") +const environment = require("../environment") const DEFINITIONS = { [SourceNames.POSTGRES]: postgres.schema, @@ -24,7 +25,6 @@ const DEFINITIONS = { [SourceNames.MYSQL]: mysql.schema, [SourceNames.ARANGODB]: arangodb.schema, [SourceNames.REST]: rest.schema, - [SourceNames.GOOGLE_SHEETS]: googlesheets.schema, } const INTEGRATIONS = { @@ -39,7 +39,6 @@ const INTEGRATIONS = { [SourceNames.MYSQL]: mysql.integration, [SourceNames.ARANGODB]: arangodb.integration, [SourceNames.REST]: rest.integration, - [SourceNames.GOOGLE_SHEETS]: googlesheets.integration, } // optionally add oracle integration if the oracle binary can be installed @@ -49,6 +48,11 @@ if (!(process.arch === "arm64" && process.platform === "darwin")) { INTEGRATIONS[SourceNames.ORACLE] = oracle.integration } +if (environment.SELF_HOSTED) { + DEFINITIONS[SourceNames.GOOGLE_SHEETS] = googlesheets.schema + INTEGRATIONS[SourceNames.GOOGLE_SHEETS] = googlesheets.integration +} + module.exports = { definitions: DEFINITIONS, integrations: INTEGRATIONS, diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index ef099a7050..bbf5ec7690 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.0.50-alpha.7", + "version": "1.0.57", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index e3bf0022d0..29bff0d02d 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.0.50-alpha.7", + "version": "1.0.57", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -34,8 +34,8 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^1.0.50-alpha.7", - "@budibase/string-templates": "^1.0.50-alpha.7", + "@budibase/backend-core": "^1.0.57", + "@budibase/string-templates": "^1.0.57", "@koa/router": "^8.0.0", "@sentry/node": "^6.0.0", "@techpass/passport-openidconnect": "^0.3.0", diff --git a/packages/worker/src/api/routes/global/auth.js b/packages/worker/src/api/routes/global/auth.js index 373bf5736a..cc00b4f82f 100644 --- a/packages/worker/src/api/routes/global/auth.js +++ b/packages/worker/src/api/routes/global/auth.js @@ -80,6 +80,11 @@ router updateTenant, authController.googleAuth ) + .get( + "/api/global/auth/:tenantId/datasource/:provider/callback", + updateTenant, + authController.datasourceAuth + ) .get( "/api/global/auth/:tenantId/oidc/configs/:configId", updateTenant,