1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Encrypted Secretsで暗号化したsecrets.ymlでタイポした時

1
Posted at

起こった問題

Encrypted secretsで暗号化したsecrets.ymlを編集

bin/rails s

を実行したら、エラー

psych.rb:377:in `parse': (<unknown>): could not find expected ':' while scanning a simple key at line 5 column 3 (Psych::SyntaxError)

どうやら原因はsecrets.ymlのタイポらしいので修正を試みる

EDITOR=vim bin/rails secrets:edit

するとまた同じエラー

psych.rb:377:in `parse': (<unknown>): could not find expected ':' while scanning a simple key at line 5 column 3 (Psych::SyntaxError)

タイポのせいでbin/railsコマンドが全て封じられたっぽい
エラーの輪廻に閉じ込められてしまった。。。笑

解決策

config/application.rbを以下のようにする

config.read_encrypted_secrets = false

encrypted secretsの設定を読み込まないようにしたところ

EDITOR=vim bin/rails secrets:edit

のコマンドで編集できるようになった。
タイポを修正して、config/application.rbを元に戻す

config.read_encrypted_secrets = true
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?