From f8396725d1d37e1b3d8e01e41af51d764ff6307e Mon Sep 17 00:00:00 2001 From: adrinr Date: Mon, 13 Mar 2023 14:25:19 +0100 Subject: [PATCH] Init pro with the save user function --- packages/worker/src/index.ts | 2 ++ packages/worker/src/initPro.ts | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 packages/worker/src/initPro.ts diff --git a/packages/worker/src/index.ts b/packages/worker/src/index.ts index 0b4e3be817..5084972a4c 100644 --- a/packages/worker/src/index.ts +++ b/packages/worker/src/index.ts @@ -35,6 +35,7 @@ const logger = require("koa-pino-logger") const { userAgent } = require("koa-useragent") import destroyable from "server-destroy" +import { initPro } from "./initPro" // configure events to use the pro audit log write // can't integrate directly into backend-core due to cyclic issues @@ -108,6 +109,7 @@ const shutdown = () => { export default server.listen(parseInt(env.PORT || "4002"), async () => { console.log(`Worker running on ${JSON.stringify(server.address())}`) + await initPro() await redis.init() }) diff --git a/packages/worker/src/initPro.ts b/packages/worker/src/initPro.ts new file mode 100644 index 0000000000..793b8dd8b5 --- /dev/null +++ b/packages/worker/src/initPro.ts @@ -0,0 +1,12 @@ +import { sdk as proSdk } from "@budibase/pro" +import * as userSdk from "./sdk/users" + +export const initPro = async () => { + await proSdk.init({ + scimUserServiceConfig: { + functions: { + saveUser: userSdk.save, + }, + }, + }) +}