use google env variable for client secret and ID, update helm chart to pass variables to worker
This commit is contained in:
parent
08a3ae0e7c
commit
0966720982
|
@ -11,8 +11,8 @@ sources:
|
||||||
- https://github.com/Budibase/budibase
|
- https://github.com/Budibase/budibase
|
||||||
- https://budibase.com
|
- https://budibase.com
|
||||||
type: application
|
type: application
|
||||||
version: 0.2.5
|
version: 0.2.6
|
||||||
appVersion: 1.0.25
|
appVersion: 1.0.47
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: couchdb
|
- name: couchdb
|
||||||
version: 3.3.4
|
version: 3.3.4
|
||||||
|
|
|
@ -111,6 +111,10 @@ spec:
|
||||||
value: {{ .Values.globals.smtp.from | quote }}
|
value: {{ .Values.globals.smtp.from | quote }}
|
||||||
- name: APPS_URL
|
- name: APPS_URL
|
||||||
value: http://app-service:{{ .Values.services.apps.port }}
|
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 }}
|
image: budibase/worker:{{ .Values.globals.appVersion }}
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
name: bbworker
|
name: bbworker
|
||||||
|
|
|
@ -11,6 +11,8 @@ module.exports = {
|
||||||
COUCH_DB_URL: process.env.COUCH_DB_URL,
|
COUCH_DB_URL: process.env.COUCH_DB_URL,
|
||||||
COUCH_DB_USERNAME: process.env.COUCH_DB_USER,
|
COUCH_DB_USERNAME: process.env.COUCH_DB_USER,
|
||||||
COUCH_DB_PASSWORD: process.env.COUCH_DB_PASSWORD,
|
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,
|
SALT_ROUNDS: process.env.SALT_ROUNDS,
|
||||||
REDIS_URL: process.env.REDIS_URL,
|
REDIS_URL: process.env.REDIS_URL,
|
||||||
REDIS_PASSWORD: process.env.REDIS_PASSWORD,
|
REDIS_PASSWORD: process.env.REDIS_PASSWORD,
|
||||||
|
|
|
@ -1,20 +1,17 @@
|
||||||
const { getScopedConfig } = require("../../../db/utils")
|
|
||||||
const { getGlobalDB } = require("../../../tenancy")
|
|
||||||
const google = require("../google")
|
const google = require("../google")
|
||||||
const { Configs, Cookies } = require("../../../constants")
|
const { Cookies } = require("../../../constants")
|
||||||
const { clearCookie, getCookie } = require("../../../utils")
|
const { clearCookie, getCookie } = require("../../../utils")
|
||||||
const { getDB } = require("../../../db")
|
const { getDB } = require("../../../db")
|
||||||
const environment = require("../../../environment")
|
const environment = require("../../../environment")
|
||||||
|
|
||||||
async function preAuth(passport, ctx, next) {
|
async function preAuth(passport, ctx, next) {
|
||||||
const db = getGlobalDB()
|
|
||||||
// get the relevant config
|
// get the relevant config
|
||||||
const config = await getScopedConfig(db, {
|
const googleConfig = {
|
||||||
type: Configs.GOOGLE,
|
clientID: environment.GOOGLE_CLIENT_ID,
|
||||||
workspace: ctx.query.workspace,
|
clientSecret: environment.GOOGLE_CLIENT_SECRET,
|
||||||
})
|
}
|
||||||
let callbackUrl = `${environment.PLATFORM_URL}/api/global/auth/datasource/google/callback`
|
let callbackUrl = `${environment.PLATFORM_URL}/api/global/auth/datasource/google/callback`
|
||||||
const strategy = await google.strategyFactory(config, callbackUrl)
|
const strategy = await google.strategyFactory(googleConfig, callbackUrl)
|
||||||
|
|
||||||
if (!ctx.query.appId || !ctx.query.datasourceId) {
|
if (!ctx.query.appId || !ctx.query.datasourceId) {
|
||||||
ctx.throw(400, "appId and datasourceId query params not present.")
|
ctx.throw(400, "appId and datasourceId query params not present.")
|
||||||
|
@ -28,12 +25,11 @@ async function preAuth(passport, ctx, next) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function postAuth(passport, ctx, next) {
|
async function postAuth(passport, ctx, next) {
|
||||||
const db = getGlobalDB()
|
// get the relevant config
|
||||||
|
const config = {
|
||||||
const config = await getScopedConfig(db, {
|
clientID: environment.GOOGLE_CLIENT_ID,
|
||||||
type: Configs.GOOGLE,
|
clientSecret: environment.GOOGLE_CLIENT_SECRET,
|
||||||
workspace: ctx.query.workspace,
|
}
|
||||||
})
|
|
||||||
|
|
||||||
let callbackUrl = `${environment.PLATFORM_URL}/api/global/auth/datasource/google/callback`
|
let callbackUrl = `${environment.PLATFORM_URL}/api/global/auth/datasource/google/callback`
|
||||||
const strategy = await google.strategyFactory(
|
const strategy = await google.strategyFactory(
|
||||||
|
|
Loading…
Reference in New Issue