Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
♻️ Turn conferencing providers on individually with CONFERENCING_PROVIDERS
Luke Vella04f7ce8372ec
diff --git a/apps/docs/self-hosting/conferencing.mdx b/apps/docs/self-hosting/conferencing.mdxindex 2b2bc71f7..d3bc0e43d 100644--- a/apps/docs/self-hosting/conferencing.mdx+++ b/apps/docs/self-hosting/conferencing.mdx@@ -8,7 +8,7 @@ description: Let organizers add Google Meet, Zoom, Microsoft Teams and Webex linWith conferencing enabled, organizers connect a Google Meet, Zoom, Microsoft Teams or Webex account in **Settings** > **Conferencing**. When they finalize a poll, Rallly creates the meeting on that account and puts the join link in the event, the calendar invite and the confirmation emails. See the [integration guides](/integrations/google-meet) for what organizers see.-Each provider needs an OAuth app that you register with the provider yourself. Rallly cannot ship one for you, because the redirect URI of an OAuth app is tied to your instance's domain. You can enable any combination of providers; on a self-hosted instance every provider is available on every plan.+Each provider needs an OAuth app that you register with the provider yourself. Rallly cannot ship one for you, because the redirect URI of an OAuth app is tied to your instance's domain. You turn on each provider separately; on a self-hosted instance every provider is available on every plan.## Enable conferencing@@ -17,22 +17,22 @@ Each provider needs an OAuth app that you register with the provider yourself. RFollow the setup for each provider you want below. Google Meet and Microsoft Teams reuse the app you may already have for [Single Sign-On](/self-hosting/single-sign-on).</Step><Step title="Set the variables">- Add `CONFERENCING_ENABLED=true` and the provider's variables to your `.env`.+ Add the provider's variables to your `.env`, and list it in `CONFERENCING_PROVIDERS`, for example `CONFERENCING_PROVIDERS=google-meet,zoom`.</Step><Step title="Restart">Run `./rallly.sh restart`. **Conferencing** appears in **Settings** for every user.</Step></Steps>-<ParamField path="CONFERENCING_ENABLED" default="false">- Turns on **Add video call** on the poll form, where organizers can always paste their own link. Each provider whose OAuth app variables are set is offered there and in **Settings** > **Conferencing**. If no provider is configured, Rallly logs a warning at startup and the Conferencing page says so.+<ParamField path="CONFERENCING_PROVIDERS">+ A comma separated list of the providers organizers can use: `google-meet`, `zoom`, `microsoft-teams`, `webex`. A listed provider is offered once its OAuth app variables are set; Google and Microsoft credentials used for sign in never turn on Meet or Teams by themselves. An unknown value stops Rallly from starting. A listed provider without credentials is not offered, Rallly logs a warning at startup, and the Conferencing page says no provider is set up. Organizers can always paste their own video call link, whatever this lists.</ParamField>Every redirect URI below starts with your instance's public address, written as `https://<YOUR_DOMAIN>`. It must match exactly, including the scheme and without a trailing slash.## Google Meet-Google Meet uses the same Google OAuth app as Google sign in and Google Calendar. If `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET` are already set, Google Meet is offered as soon as you set `CONFERENCING_ENABLED=true`, so finish the steps below first.+Google Meet uses the same Google OAuth app as Google sign in and Google Calendar. Setting the Google variables for sign in does not turn on Google Meet: finish the steps below, then add `google-meet` to `CONFERENCING_PROVIDERS`.<Accordion title="Setup">1. In the [Google Cloud console](https://console.cloud.google.com/), open the project that holds your OAuth client, or create one.@@ -108,7 +108,7 @@ https://<YOUR_DOMAIN>/api/integrations/zoom/deauthorize## Microsoft Teams-Microsoft Teams uses the same Microsoft Entra ID registration as Microsoft sign in, with an extra redirect URI and Graph permissions. If `MICROSOFT_CLIENT_ID` and `MICROSOFT_CLIENT_SECRET` are already set, Teams is offered as soon as you set `CONFERENCING_ENABLED=true`, so finish the steps below first.+Microsoft Teams uses the same Microsoft Entra ID registration as Microsoft sign in, with an extra redirect URI and Graph permissions. Setting the Microsoft variables for sign in does not turn on Teams: finish the steps below, then add `microsoft-teams` to `CONFERENCING_PROVIDERS`.<Accordion title="Setup">1. Register an application in the [Microsoft Entra admin center](https://entra.microsoft.com/), or open your existing one. See [Single Sign-On](/self-hosting/single-sign-on#microsoft) for sign in.@@ -164,11 +164,11 @@ https://<YOUR_DOMAIN>/api/integrations/callback/webex## Troubleshooting-**Rallly does not start after adding Zoom or Webex.** Only one of `ZOOM_CLIENT_ID` and `ZOOM_CLIENT_SECRET` (or the Webex pair) is set. Run `./rallly.sh logs web` to see which.+**Rallly does not start after enabling conferencing.** `CONFERENCING_PROVIDERS` has a value that is not a provider, or only one of `ZOOM_CLIENT_ID` and `ZOOM_CLIENT_SECRET` (or the Webex pair) is set. Run `./rallly.sh logs web` to see which.-**Conferencing does not appear in Settings.** `CONFERENCING_ENABLED` is not `true`. Restart after editing `.env`.+**Conferencing does not appear in Settings.** `CONFERENCING_PROVIDERS` is unset or empty. Restart after editing `.env`.-**Conferencing says no video call providers are set up.** `CONFERENCING_ENABLED` is `true` but no provider's variables are set. Add them as described above and restart.+**Conferencing says no video call providers are set up, or a provider is missing.** A provider in `CONFERENCING_PROVIDERS` has no credentials. The startup warning in `./rallly.sh logs web` names it; add its variables as described above and restart.**The provider says the redirect URI does not match** (`redirect_uri_mismatch` on Google). The URI registered with the provider differs from the one Rallly sends. Compare it character by character with the URI above, including `https`, your exact domain and the provider name at the end.diff --git a/apps/docs/self-hosting/configuration.mdx b/apps/docs/self-hosting/configuration.mdxindex 7b4e2fdcd..65f120b32 100644--- a/apps/docs/self-hosting/configuration.mdx+++ b/apps/docs/self-hosting/configuration.mdx@@ -102,7 +102,7 @@ See the [Single Sign-On guide](/self-hosting/single-sign-on) for setup instructi## Video Conferencing-Google Meet, Zoom, Microsoft Teams and Webex links on polls are turned on with `CONFERENCING_ENABLED` and an OAuth app per provider. See the [Video Conferencing guide](/self-hosting/conferencing) for setup instructions and the full list of variables.+Google Meet, Zoom, Microsoft Teams and Webex links on polls are turned on per provider with `CONFERENCING_PROVIDERS` and an OAuth app for each. See the [Video Conferencing guide](/self-hosting/conferencing) for setup instructions and the full list of variables.<Note>Available from v4.16.0 and later.</Note>diff --git a/apps/docs/self-hosting/single-sign-on.mdx b/apps/docs/self-hosting/single-sign-on.mdxindex ff935cb2e..7064313ea 100644--- a/apps/docs/self-hosting/single-sign-on.mdx+++ b/apps/docs/self-hosting/single-sign-on.mdx@@ -60,7 +60,7 @@ Once the claims are present, a Microsoft sign-in whose address Microsoft does no</Accordion><Accordion title="Using the same registration for Microsoft Teams">-With `CONFERENCING_ENABLED=true` (see [Video Conferencing](/self-hosting/conferencing)), the Microsoft registration also powers the [Microsoft Teams integration](/integrations/microsoft-teams); there are no separate Teams variables. Add the redirect URI:+With `microsoft-teams` in `CONFERENCING_PROVIDERS` (see [Video Conferencing](/self-hosting/conferencing)), the Microsoft registration also powers the [Microsoft Teams integration](/integrations/microsoft-teams); there are no separate Teams variables. Add the redirect URI:```https://<YOUR_DOMAIN>/api/integrations/callback/microsoft-teamsdiff --git a/apps/web/.env.sample b/apps/web/.env.sampleindex 60c1b1118..03ea94c3a 100644--- a/apps/web/.env.sample+++ b/apps/web/.env.sample@@ -44,17 +44,17 @@ KV_REST_API_TOKEN=dev_fake_token_123456789abcdefghijklmnop# Enable to remove the pay-wall and subscription billing functionalityNEXT_PUBLIC_SELF_HOSTED=false-# Conferencing integrations (optional). Set CONFERENCING_ENABLED=true to let-# users connect Zoom, Google Meet, Microsoft Teams and Webex and add meeting-# links to their events. Google Meet reuses GOOGLE_CLIENT_ID /-# GOOGLE_CLIENT_SECRET.+# Conferencing integrations (optional). CONFERENCING_PROVIDERS lists the+# providers users can connect, as a comma separated list of google-meet, zoom,+# microsoft-teams and webex; each also needs its OAuth app below. Google Meet+# reuses GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRET.# Microsoft Teams reuses MICROSOFT_CLIENT_ID / MICROSOFT_CLIENT_SECRET: the# registration needs the delegated Microsoft Graph permission# OnlineMeetings.ReadWrite and the redirect URI# <base url>/api/integrations/callback/microsoft-teams. Teams connects through# the `organizations` authority when MICROSOFT_TENANT_ID is common or# consumers, and through the configured tenant otherwise.-# CONFERENCING_ENABLED=false+# CONFERENCING_PROVIDERS=google-meet,zoom# ZOOM_CLIENT_ID=# ZOOM_CLIENT_SECRET=# Secret Token from the Zoom app's Features page; verifies deauthorization events.diff --git a/apps/web/.env.test b/apps/web/.env.testindex 772b1e497..e8e21a7a9 100644--- a/apps/web/.env.test+++ b/apps/web/.env.test@@ -20,7 +20,7 @@ WEBHOOK_ALLOW_PRIVATE_URLS=true# Conferencing integrations: the Zoom app is a stand-in so the provider is# offered; the OAuth round trip itself is never driven in tests.-CONFERENCING_ENABLED=true+CONFERENCING_PROVIDERS=zoomZOOM_CLIENT_ID=test-zoomZOOM_CLIENT_SECRET=test-zoom-secretZOOM_WEBHOOK_SECRET_TOKEN=test-zoom-webhook-secretdiff --git a/apps/web/src/app/api/integrations/[...connection]/route.ts b/apps/web/src/app/api/integrations/[...connection]/route.tsindex 93c283331..234db06ca 100644--- a/apps/web/src/app/api/integrations/[...connection]/route.ts+++ b/apps/web/src/app/api/integrations/[...connection]/route.ts@@ -4,7 +4,7 @@ import {syncCalendars,} from "@/features/calendars/mutations";import {- isConferencingEnabled,+ enabledConferencingProviders,MICROSOFT_TEAMS_SCOPES,WEBEX_SCOPES,} from "@/features/conferencing/constants";@@ -117,7 +117,7 @@ const { handler } = OAuthIntegration<Integration>({}case "google-meet": {if (- !isConferencingEnabled ||+ !enabledConferencingProviders.includes("meet") ||!env.GOOGLE_CLIENT_ID ||!env.GOOGLE_CLIENT_SECRET) {@@ -140,7 +140,7 @@ const { handler } = OAuthIntegration<Integration>({}case "zoom": {if (- !isConferencingEnabled ||+ !enabledConferencingProviders.includes("zoom") ||!env.ZOOM_CLIENT_ID ||!env.ZOOM_CLIENT_SECRET) {@@ -159,7 +159,7 @@ const { handler } = OAuthIntegration<Integration>({}case "webex": {if (- !isConferencingEnabled ||+ !enabledConferencingProviders.includes("webex") ||!env.WEBEX_CLIENT_ID ||!env.WEBEX_CLIENT_SECRET) {@@ -178,7 +178,7 @@ const { handler } = OAuthIntegration<Integration>({}case "microsoft-teams": {if (- !isConferencingEnabled ||+ !enabledConferencingProviders.includes("teams") ||!env.MICROSOFT_CLIENT_ID ||!env.MICROSOFT_CLIENT_SECRET) {diff --git a/apps/web/src/env.ts b/apps/web/src/env.tsindex b12bb2bdd..3d0b4da81 100644--- a/apps/web/src/env.ts+++ b/apps/web/src/env.ts@@ -116,10 +116,10 @@ export const env = createEnv({/*** Conferencing integrations (Google Meet, Zoom, Microsoft Teams, Webex).- * The flag needs at least one provider's OAuth app configured; see- * createFinalSchema below.+ * CONFERENCING_PROVIDERS lists the ones turned on by integration id; each+ * is offered once its OAuth app below is set too.*/- CONFERENCING_ENABLED: z.enum(["true", "false"]).default("false"),+ CONFERENCING_PROVIDERS: z.string().optional(),ZOOM_CLIENT_ID: z.string().optional(),ZOOM_CLIENT_SECRET: z.string().optional(),// Signs Zoom's event notifications, including app deauthorization.@@ -312,7 +312,7 @@ export const env = createEnv({LICENSE_API_AUTH_TOKEN: process.env.LICENSE_API_AUTH_TOKEN,GOOGLE_CLIENT_ID: process.env.GOOGLE_CLIENT_ID,GOOGLE_CLIENT_SECRET: process.env.GOOGLE_CLIENT_SECRET,- CONFERENCING_ENABLED: process.env.CONFERENCING_ENABLED,+ CONFERENCING_PROVIDERS: process.env.CONFERENCING_PROVIDERS,ZOOM_CLIENT_ID: process.env.ZOOM_CLIENT_ID,ZOOM_CLIENT_SECRET: process.env.ZOOM_CLIENT_SECRET,ZOOM_WEBHOOK_SECRET_TOKEN: process.env.ZOOM_WEBHOOK_SECRET_TOKEN,@@ -367,6 +367,24 @@ export const env = createEnv({});}+ const conferencingIds = [+ "google-meet",+ "zoom",+ "microsoft-teams",+ "webex",+ ];+ const unknownConferencing = (env.CONFERENCING_PROVIDERS ?? "")+ .split(",")+ .map((entry) => entry.trim().toLowerCase())+ .filter((entry) => entry && !conferencingIds.includes(entry));+ if (unknownConferencing.length > 0) {+ ctx.addIssue({+ code: "custom",+ path: ["CONFERENCING_PROVIDERS"],+ message: `CONFERENCING_PROVIDERS has unknown values: ${unknownConferencing.join(", ")}. Use a comma separated list of ${conferencingIds.join(", ")}.`,+ });+ }+if (Boolean(env.WEBEX_CLIENT_ID) !== Boolean(env.WEBEX_CLIENT_SECRET)) {ctx.addIssue({code: "custom",diff --git a/apps/web/src/features/conferencing/constants.ts b/apps/web/src/features/conferencing/constants.tsindex db13eee19..d86df5cd4 100644--- a/apps/web/src/features/conferencing/constants.ts+++ b/apps/web/src/features/conferencing/constants.ts@@ -1,18 +1,29 @@import type { ConferencingProvider } from "./schema";+import { integrationIdToConferencingProvider } from "./utils";-export const isConferencingEnabled =- process.env.CONFERENCING_ENABLED === "true";+// The providers the operator turned on, by integration id+// (`CONFERENCING_PROVIDERS=google-meet,zoom`). Each maps onto a future+// Control Panel toggle. env.ts rejects unknown ids at boot.+export const enabledConferencingProviders: ConferencingProvider[] = (+ process.env.CONFERENCING_PROVIDERS ?? ""+)+ .split(",")+ .flatMap((entry) => {+ const provider = integrationIdToConferencingProvider(+ entry.trim().toLowerCase(),+ );+ return provider ? [provider] : [];+ });++export const isConferencingEnabled = enabledConferencingProviders.length > 0;export const CONFERENCING_SETUP_DOCS_URL ="https://support.rallly.co/self-hosting/conferencing";-// A provider is offered when its OAuth app is configured; Google Meet reuses-// the Google OAuth app the calendars integration already needs, and Microsoft-// Teams the Microsoft app sign in uses. Webex has an integration of its own.-export function getAvailableConferencingProviders(): ConferencingProvider[] {- if (!isConferencingEnabled) {- return [];- }+// Providers whose OAuth app is configured. Google Meet reuses the Google+// OAuth app the calendars integration already needs, and Microsoft Teams the+// Microsoft app sign in uses. Webex has an integration of its own.+export function getConfiguredConferencingProviders(): ConferencingProvider[] {const providers: ConferencingProvider[] = [];if (process.env.GOOGLE_CLIENT_ID && process.env.GOOGLE_CLIENT_SECRET) {providers.push("meet");@@ -29,6 +40,16 @@ export function getAvailableConferencingProviders(): ConferencingProvider[] {return providers;}+// A provider is offered when the operator turned it on and its OAuth app is+// configured. Shared credentials alone (Google or Microsoft sign in) never+// turn on Meet or Teams.+export function getAvailableConferencingProviders(): ConferencingProvider[] {+ const configured = getConfiguredConferencingProviders();+ return enabledConferencingProviders.filter((provider) =>+ configured.includes(provider),+ );+}+// `offline_access` is what makes Microsoft issue a refresh token.export const MICROSOFT_TEAMS_SCOPES = ["openid",diff --git a/apps/web/src/instrumentation.ts b/apps/web/src/instrumentation.tsindex 24aee452c..5a7ac11c8 100644--- a/apps/web/src/instrumentation.ts+++ b/apps/web/src/instrumentation.ts@@ -12,17 +12,19 @@ export async function register() {await import("../sentry.server.config");- // Conferencing is optional, so a switch with no provider behind it must- // not stop the server; organizers can still paste their own link.- const { getAvailableConferencingProviders, isConferencingEnabled } =+ // Conferencing is optional, so a provider turned on without its OAuth+ // app must not stop the server; it is simply not offered.+ const { enabledConferencingProviders, getConfiguredConferencingProviders } =await import("@/features/conferencing/constants");- if (- isConferencingEnabled &&- getAvailableConferencingProviders().length === 0- ) {+ const configured = getConfiguredConferencingProviders();+ const unconfigured = enabledConferencingProviders.filter(+ (provider) => !configured.includes(provider),+ );+ if (unconfigured.length > 0) {const { createLogger } = await import("@rallly/logger");createLogger("conferencing").warn(- "CONFERENCING_ENABLED is set but no provider is configured, so none is offered. Set the OAuth app variables for Zoom, Google Meet, Microsoft Teams or Webex.",+ { providers: unconfigured },+ "CONFERENCING_PROVIDERS lists providers without OAuth app credentials, so they are not offered.",);}