The discussion revolves around setting environment variables for test and development purposes in a Discourse plugin. jamesmarkcook considers adding the dotenv gem to load environment variables per environment but wonders if there’s a better approach. pfaffman suggests setting DISCOURSE_SETTING_NAME=value for SiteSettings, but jamesmarkcook explains that this doesn’t meet his needs for sensitive data in a private plugin.
pfaffman recommends setting DISCOURSE_MY_PLUGIN_SETTING and using GlobalSetting.my_plugin_setting in tests. jamesmarkcook will explore this option. Meanwhile, fzngagan shares an alternative solution by setting ENV['yourkey'] = 'yourval' directly in the plugin and points out the possibility of installing gems specific to modes.
Unfortunately not. I’m working on a private plugin and need to set an environment variable for sensitive data so that I’m not checking it into source control.
It’s fine setting that environment variable on the production server, but I want to be able to load this into the test environment when running tests for example. I could specify it inline, but ideally I’d want a more scalable solution.
The reason I posted is because adding that gem feels wrong, I would have assumed that Discourse would already have a solution for this problem.