Injecting secrets while debugging Dart code on VSCode

I am trying to use doppler to manage secrets for my dart application. I use VSCode and the DartCode extension to debug my code. I cannot figure out how to get doppler to automatically inject the secrets before my dart code runs.

I can manually run the code via doppler run -- dart /my/dart/file.dart but this doesn’t automatically attach the vscode debugger. How can I setup my launch config such that this is done automatically? DartCode does not support the"runtimeExecutable": “doppler” option from the nodejs debugger as mentioned in the Doppler docs.

I have also filed an issue here: Feature: Specify shell or executable to use when debugging · Issue #3674 · Dart-Code/Dart-Code · GitHub

Hey Andrew (@coastalcompile)!

I noticed v3.29.0 of the Dart extension that was released on December 1st which added debugger support for a customTool.

Does the launch.json example in the comments for that issue provide the solution you need?

If so, I’d love to have you share the working launch configuration here so we can add it to our documentation.

Ryan,

I would love to make use of that new feature since it is intended to solve this very issue. I have done some tests and attempted to get it to work but could not. As such, I opened a new issue here: VSCode Dart Extension // customTool arg does not appear to work as intended · Issue #3749 · Dart-Code/Dart-Code · GitHub

Once that gets resolved, I’ll create an example config and will post it back here.

1 Like

That would be brilliant Andrew! Thanks!

Here is a working config for dart projects (does not work for flutter):

        {
            "name": "Debug with Doppler Env",
            "request": "launch",
            "type": "dart",
            "program": "bin/main.dart",
            "customTool": "doppler",
            "toolArgs": [
                "run",
                "--",
                "dart"
            ]
        },
1 Like