Rails 5.2 加密凭据未保存
Rails 5.2 encrypted credentials not saving
当我执行 bin/rails credentials:edit
时,我的编辑器会打开一个包含默认内容的文件,例如 credentials.yml.enc.1234
。完成编辑后,我点击保存,控制台显示 New credentials encrypted and saved.
在我再次 运行 bin/rails credentials:edit
之后,另一个临时文件被打开 (credentials.yml.enc.4321
) 并且内容恢复为默认值。
如何使凭据持久化?
存在与此相关的问题:
https://github.com/rails/rails/issues/31286
已在 5.2.0.rc1 中修复
我在 rails 5.2.0 中使用 textmate 作为编辑器时遇到了这个问题。事实证明,凭证文件必须在保存后关闭才能使更改持续存在。
如果您不使用 vim
,您需要向编辑器添加一个 wait
标志。
例如 atom
:
EDITOR="atom --wait" rails credentials:edit
我运行进入了同样的东西并找到了答案here。
我在使用 atom 作为编辑器时也遇到了这个问题。
我试过:
EDITOR="atom --wait" rails credentials:edit
和
EDITOR="atom -w" rails credentials:edit
但没有结果。最后,我使用了 nano (ubuntu):
EDITOR="nano" rails credentials:edit
对我来说,这很好用。也许,作为替代方案,它会对某人有所帮助。
您可以使用以下方法在 sublime 中打开凭据文件。
EDITOR="subl --wait" bin/rails credentials:edit
确保在进行更改后关闭 sublime 中的凭据文件。
同时重新启动服务器以查看更改。
当我执行 bin/rails credentials:edit
时,我的编辑器会打开一个包含默认内容的文件,例如 credentials.yml.enc.1234
。完成编辑后,我点击保存,控制台显示 New credentials encrypted and saved.
在我再次 运行 bin/rails credentials:edit
之后,另一个临时文件被打开 (credentials.yml.enc.4321
) 并且内容恢复为默认值。
如何使凭据持久化?
存在与此相关的问题: https://github.com/rails/rails/issues/31286
已在 5.2.0.rc1 中修复
我在 rails 5.2.0 中使用 textmate 作为编辑器时遇到了这个问题。事实证明,凭证文件必须在保存后关闭才能使更改持续存在。
如果您不使用 vim
,您需要向编辑器添加一个 wait
标志。
例如 atom
:
EDITOR="atom --wait" rails credentials:edit
我运行进入了同样的东西并找到了答案here。
我在使用 atom 作为编辑器时也遇到了这个问题。 我试过:
EDITOR="atom --wait" rails credentials:edit
和
EDITOR="atom -w" rails credentials:edit
但没有结果。最后,我使用了 nano (ubuntu):
EDITOR="nano" rails credentials:edit
对我来说,这很好用。也许,作为替代方案,它会对某人有所帮助。
您可以使用以下方法在 sublime 中打开凭据文件。
EDITOR="subl --wait" bin/rails credentials:edit
确保在进行更改后关闭 sublime 中的凭据文件。 同时重新启动服务器以查看更改。