How to set Environment Variables containing JSON?

On the docs site there are some environment variables which require a string containing JSON:

MB_APPLICATION_COLORS
MB_CUSTOM_FORMATTING
MB_CUSTOM_GEOJSON
MB_JWT_GROUP_MAPPINGS
MB_LDAP_GROUP_MAPPINGS
MB_SAML_GROUP_MAPPINGS

Could someone share an example on how to set these properly?

My problem may be specific to MB_CUSTOM_GEOJSON, but I can't seem to find a format for the value which will actually be read by Metabase. The results are all parsing errors. I've been trying to just set the default value to start with:

"{"us_states":{"name":"USA","url":"app/assets/geojson/us-states.json","region_key":"STATE","region_name":"NAME"},"world_countries":{"name":"World","url":"app/assets/geojson/world.json","region_key":"ISO_A2","region_name":"NAME"}}"

Things I've tried:

  • The above as shown
  • The above without the first and last double quotes
  • The above with a single quote instead of the first and last double quotes
  • Escaping the double quotes with a backslash, with and without first and last quotes

When I look at /proc/*/environ for the Metabase process, the value is being set as specified. However I get either a parsing error at app startup like:

"type":"java.lang.ClassCastException","message":"class java.lang.String cannot be cast to class clojure.lang.IPersistentCollection (java.lang.String is in module java.base of loader 'bootstrap'; clojure.lang.IPersistentCollection is in unnamed module of loader 'app')"

or the value is not actually set in Metabase (as shown by /api/setting), rather it is "null". In this case Metabase can start up OK but the setting being null causes the /api/settings/maps to show a blank white screen, with the JS console saying TypeError: can't convert null to object.

Hi @lindsay-stevens
I've created two issues:
https://github.com/metabase/metabase/issues/18862 - GeoJSON error
https://github.com/metabase/metabase/issues/18864 - difficult to understand, when settings are applied

The easiest way to figure out what to define is by setting the options via the GUI and copy the value to an environment variable. There's so many different options available.

Also, you'll need to wrap the envvar value in single-quote, or escape the double-quotes inside.
Example: MB_APPLICATION_COLORS='{"brand":"#ff0080"}'