How to use Doppler with RubyMine IDE

Hi all, how can I configure doppler to run/debug my rails app in RubyMine?

Hi @lizzie!

Welcome to the Doppler Community!

Sorry for the delay getting back to you on this! I did some looking at RubyMine and it looks like you can somewhat accomplish this using RubyMine’s support for External Tools. In the Run/debug configuration there’s a Before launch section where you can have it run an External Tool. This would let you hook in and execute your application using Doppler when you run the debugger. Here are some screenshots showing how you might do that:

  1. 3

  2. 4

Will that work for what you’re after?

Hi, thanks so much for the response!

This works just for running the app regularly, but not for the built in RubyMine debugger - do you know if there’s another way I can set this up to get debugging working?

For reference, this is the command that’s run when I run a rails app with the debugger:

/Users/lizzie/.asdf/installs/ruby/2.7.5/bin/ruby /Users/lizzie/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/ruby-debug-ide-2.3.1/bin/rdebug-ide --key-value --step-over-in-blocks --disable-int-handler --evaluation-timeout 10 --evaluation-control --time-limit 100 --memory-limit 0 --rubymine-protocol-extensions --port 60007 --host 0.0.0.0 --dispatcher-port 60008 -- /Users/lizzie/workspace/os-app/bin/rails server -b 0.0.0.0 -p 3000 -e development

Hi @lizzie!

We just released a gem that might help you here. Could you give it a look?

The TL;DR is that you require it in your application and it will either execute the CLI using the credentials setup for the project directly with doppler setup or if DOPPLER_TOKEN is set, it’ll use that to pull in secrets via the API. It then sets them in ENV.

To use it:

gem install doppler-env

and then add this as the first require in your project:

require "doppler-env/load"

For a Rails application, adding the require at the top of config/environments/development.rb works great.

Keep in mind, this is meant to be used solely in a development environment and not in production. It should get things working in RubyMine for you though!

Let me know if it helps!

Regards,
-Joel