metabase / metabase/metabase

Allow setting multi-tenant strategy through ENV variable

Open Beginner friendly
#73,434 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

.Auto triaged .Team/UXWest Administration/Tenants Embedding/Interactive Priority:P3 Type:New Feature
Dominant language
Clojure
Stars
49.3k
Forks
6.8k
Avg merge
1d 13h
Merged PRs (30d)
653

Description

**What problem will this feature request solve?**

We looked into use-tenants and wanted to share what we found.

It does work via config.yml (`config.settings.use-tenants: false`), so that part is correct. But it can't be set via environment variable: the setting is defined with `:can-read-from-env? false` (src/metabase/permissions/settings.clj), which means MB_USE_TENANTS is silently ignored.

The practical consequence for us is that neither option locks the setting. A value from config.yml is only re-applied at startup, and settings are shown as read-only in the admin UI only when they come from an environment variable. So an admin can still change it at any time.

**Describe the solution you'd like.**
`MB_TENANT_STRATEGY` = `true` or `false`

**How does this feature request impact you?**
We've got 7+ environments, and have had to click-ops to change to multi-tenant, plus we have to do this when we roll out new environments.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/metabase/permissions/settings.clj, where the multi-tenant setting and its environment-variable behavior are defined. Check the existing setting name and the requested MB_TENANT_STRATEGY versus MB_USE_TENANTS naming, then verify that an environment value controls the setting and makes it read-only in the admin UI.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
backend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.