Possible to override another plugin's settings? (narrative bot)

I’m building a plugin for a client and need to ensure that certain settings are configured on deployment. Narrative bot is essentially a core part of Discourse now, but is itself a plugin.

I suspect that overriding settings for narrative bot in my plugin will work because my plugin should alphabetically be loaded later, but what happens if my plugin begins with ‘a’ and I need to override a discourse plugin? Or do discourse plugins get loaded first anyway?

If you’re running the server, then the best solution is environment variables. Take the setting name from the yml file, make it uppercase, and add DISCOURSE_ to the beginning.

For example

DISCOURSE_TITLE='forcedtitle'

Will force the site title to that value, and prevent it being changed in the admin UI.

3 Likes

Does this still work for settings that aren’t ‘shadowed by global’?

Yes, we simplified things so all settings are ‘shadowed by global’ now :slight_smile:

https://github.com/discourse/discourse/commit/349c1cd08524eb19fd2cc1bd0957a98fc1a83daf

7 Likes

Great, thanks for your help!

1 Like