RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
40.27k stars 10.44k forks source link

Setting OVERWRITE_SETTING_theme-custom-css env variable doesn't take effect #29224

Open robertkli opened 1 year ago

robertkli commented 1 year ago

Description:

I wanted to set custom css without need to do this from UI. Similarly as other settings OVERWRITE_SETTING_theme-custom-css was set in env variables, but after starting rocket chat in Administration -> Layout -> custom Css value provided in env variable is not set. No related errors in log.

Steps to reproduce:

  1. Add OVERWRITE_SETTING_theme-custom-css: "test content" to environment section of rocket chat compose.yml file.
  2. Start RocketChat
  3. Go to Administration -> Layout -> custom Css

Expected behavior:

Custom css value is "test content"

Actual behavior:

Custom css value is empty image

Server Setup Information:

Client Setup Information

Additional context

It's worth to mention that other similar settings like "OVERWRITE_SETTING_Custom_Script_On_Logout" are passed correctly. Also setting theme-custom-css via rest api works correctly. Seems that issue is caused by '-' character in setting name and because of that it cannot be passed via env variables.

Relevant logs:

No relevant logs found.

sampaiodiego commented 1 year ago

I wanted to share I have done some investigation on this issue and this are the results: https://gist.github.com/sampaiodiego/8e1df929a95f60ca4a259e3124631516

it is as bash/posix limitation having env vars with dashes, but it may work depending on a few conditions.

any ways, the solution will probably be renaming the setting, removing the dashes.