【问题标题】:Rails 5.2 encrypted credentials not savingRails 5.2 加密凭证不保存
【发布时间】:2018-07-10 09:36:29
【问题描述】:

当我执行bin/rails credentials:edit 时,我的编辑器会打开一个类似credentials.yml.enc.1234 的文件,其中包含默认内容。完成编辑后,我点击保存,控制台显示New credentials encrypted and saved.

在我再次运行bin/rails credentials:edit 后,另一个临时文件被打开(credentials.yml.enc.4321)并且内容恢复为默认值。

如何使凭据保持不变?

【问题讨论】:

  • 你设置编辑器了吗?
  • 是的。到目前为止没有帮助。
  • 问题是它可以保存更改,我可以使用 rails credentials:show 看到它们,但是当重新打开文件时 - 一切都消失了

标签: ruby-on-rails ruby-on-rails-5 ruby-on-rails-5.2


【解决方案1】:

有一个与此相关的问题: https://github.com/rails/rails/issues/31286

在 5.2.0.rc1 中已经修复

【讨论】:

    【解决方案2】:

    我在使用 textmate 作为编辑器的 rails 5.2.0 中遇到了这个问题。事实证明,必须在保存后关闭凭据文件才能使更改持续存在。

    【讨论】:

      【解决方案3】:

      如果您不使用vim,则需要在编辑器中添加wait 标志。

      例如atom:

      EDITOR="atom --wait" rails credentials:edit
      

      我遇到了同样的事情,找到了答案here

      【讨论】:

      • 我需要EDITOR="subl --wait" rails credentials:edit,否则,谢谢!
      • 试过 EDITOR="code --wait" rails credentials:edit 因为我使用 VSC - 就像一个魅力!谢谢!
      【解决方案4】:

      我在使用 atom 作为编辑器时也遇到了这个问题。 我试过了:

      EDITOR="atom --wait" rails credentials:edit
      

      EDITOR="atom -w" rails credentials:edit
      

      但没有结果。最后,我使用了 nano(ubuntu):

      EDITOR="nano" rails credentials:edit
      

      对我来说,这很好用。也许,作为替代方案,它会对某人有所帮助。

      【讨论】:

        【解决方案5】:

        您可以使用以下内容在 sublime 中打开凭据文件。

        EDITOR="subl --wait" bin/rails credentials:edit
        

        确保在进行更改后关闭 sublime 中的凭据文件。 同时重新启动服务器以查看更改。

        【讨论】:

          猜你喜欢
          • 2018-12-06
          • 1970-01-01
          • 2018-10-30
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2019-07-17
          • 2019-12-31
          • 1970-01-01
          相关资源
          最近更新 更多