I am trying to add an API key and token to my credentials.yml.enc file in Rubymine. I can't seem to find a --wait flag or save the generated file from
EDITOR=rubymine rails credentials:edit
or
EDITOR="rubymine --wait" rails credentials:edit
What happens is I add my keys to the file for example:
api_client:
api_key: 123
but just by opening the file I see a
File encrypted and saved.
message before I can enter anything, so when I spin up my rails console to test my keys like:
Rails.application.credentials.api_client[:api_key]
I just get back a 'nil' value error.
When I try to edit in vim I get similar results. I can't seem to find any answers online, I am running ruby '2.6.3' with Rails 6.0.2.2 on MacOS Catalina 10.15.4. Thank you all for your time.
Solution: at this time I have found that using a different editor (ATOM) solves the short term problem. I will continue to try and understand if rubymine has this capability as well.
$ rails credentials:edit No $EDITOR to open file in. Assign one like this: EDITOR="mate --wait" bin/rails credentials:edit For editors that fork and exit immediately, it's important to pass a wait flag, otherwise the credentials will be saved immediately with no chance to edit.
credentials. yml. enc file is used to manage configuration such as environment variable, ID or password. This file is encrypted by config/master.
Launch VS Code. Open the Command Palette (⇧⌘P) and type shell command to find the Shell Command: Install code command in PATH command. Now run EDITOR="code --w" bin/rails credentials:edit.
Try this..
EDITOR="vim" bin/rails credentials:edit
Works like charm with MacOS Catalina
How about
EDITOR = "/Applications/RubyMine.app/Contents/MacOS/rubymine --wait" rails credentials:edit
in macOS Big Sur that is.
I also got "File encrypted and saved." trying to run EDITOR="vim" bin/rails credentials:edit
in a Rails 6.1 project.
It was simply a matter of the editor not being installed – I tried just the vim
command to confirm this. After installing Vim (apt-get install vim
on this Ubuntu system), it worked as expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With