Edit Rails encrypted credentials directly from VS Code by opening a credentials file and running the command. The extension launches rails credentials:edit with VS Code as the editor and opens the decrypted content in your editor window.
Features
Open config/credentials.yml.enc or environment-specific credentials (e.g. config/credentials/production.yml.enc) using the Rails command.
Choose whether decrypted credentials open in the current VS Code window or a new window.
Customize the Rails command if your project uses a different path or wrapper.
How it works
When you run the command, the extension:
Detects the environment from the active file name (e.g. production.yml.enc).
Spawns a terminal and runs the configured Rails command with EDITOR set to VS Code.
Rails decrypts the credentials and opens them in VS Code for editing.
Requirements
Rails project with encrypted credentials.
Working Rails credentials setup (e.g. config/master.key or RAILS_MASTER_KEY set).
VS Code command-line launcher available as code in your PATH (see Command Line in VS Code).
Usage
Open a Rails project in VS Code.
Open a credentials file:
config/credentials.yml.enc
config/credentials/<environment>.yml.enc
Run Rails Credentials from the Command Palette.
If the file does not end in .yml.enc, the command shows an error message.
Extension Settings
This extension contributes the following settings:
railsCredentials.command: Command to run. Default: bin/rails credentials:edit.
railsCredentials.openIn: Where to open the decrypted credentials.
railsCredentials.existingWindow (default): reuse the current window
Command not found: Ensure bin/rails (or your configured command) is executable and your project is open in VS Code.
VS Code doesn’t open the decrypted file: Verify the code command is available in your PATH (Command Palette → “Shell Command: Install 'code' command in PATH”).
Nothing happens: Make sure the active editor is a .yml.enc credentials file.