之前的博客:https://www.cnblogs.com/chentianwei/p/9167489.html

Guide:  https://guides.rubyonrails.org/security.html#custom-credentials

视频:https://gorails.com/episodes/rails-5-2-encrypted-credentials?autoplay=1


⚠️!!!

master.key文件不能加git里,放置在.gitignore中 (config/master.key)

credentials.yaml文件:

默认你不能读取的(打开只是乱码),需要在terminal中输入:

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

#(使用master key来decryted这个文件)

#参数-w, --wait 的意思是修改完并关闭这个窗口就会自动save(New credentials
#encrypted and saved. credentials.yaml文件被更新了)。Wait for window to be #closed before returning. [boolean]。 #参数-f, --foreground的意思,在foreground保持主进程.

编辑器是atom,   进入一个窗口,然后修改为:

development:
aws:
access_key_id: 123
secret_access_key: 345 production:
aws:
access_key_id: 123
secret_access_key: 345 # Used as the base secret for all MessageVerifiers in Rails, including the one protecting cookies.
secret_key_base: b0084fe4c82497767dad754d49d70a547352b2942e143d63bacec7700ba264daf632ae29cfa8889dec3046e74b9c33db47b53e4a5ede07d8ff6284d620952df1

进入控制台 rails.console:

> Rails.application.credentials.development
=> {:aws=>{:access_key_id=>123, :secret_access_key=>345}}
> Rails.application.credentials.development[:aws]
=> {:access_key_id=>123, :secret_access_key=>345}

master.key默认是隐藏的。用ls -la查看。

(GoRails) Credential的更多相关文章

  1. Cannot set a credential for principal 'sa'. (Microsoft SQL Server,错误: 15535)

    在SQL SERVER 2008上上禁用sa登录时,遇到下面错误:"Cannot set a credential for principal 'sa'. (Microsoft SQL Se ...

  2. git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree fetch origin

    git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree fetch origi ...

  3. Dynamics Webservice Call with Credential

    Dynamics Webservice call with credential /// <summary> ///WebServiceHelper 的摘要说明 /// </summ ...

  4. Azure 自动化:使用PowerShell Credential连接到Azure

    最近在中国版windows azure中新上线的自动化功能, 使用自动化,您可以导入自己的PowerShell脚本,然后设置一个运行计划使得脚本能按计划运行. 在本文中,我们来学习如何使用PowerS ...

  5. SQL Server 2008 - Cannot set a credential for principal 'sa'.

    SQL Server 2008 - Cannot set a credential for principal 'sa'. 很久没有用到SQL Server了,今天有幸在帮同事解决一个SQL Serv ...

  6. asp.net权限认证:OWIN实现OAuth 2.0 之客户端模式(Client Credential)

    asp.net权限认证系列 asp.net权限认证:Forms认证 asp.net权限认证:HTTP基本认证(http basic) asp.net权限认证:Windows认证 asp.net权限认证 ...

  7. asp.net权限认证:OWIN实现OAuth 2.0 之密码模式(Resource Owner Password Credential)

    asp.net权限认证系列 asp.net权限认证:Forms认证 asp.net权限认证:HTTP基本认证(http basic) asp.net权限认证:Windows认证 asp.net权限认证 ...

  8. 凭证(Credential)

    在SQL Server中,凭证(Credential)用于把Windows用户的身份验证信息(在Windows环境下,是Windows 用户名和密码)存储在SQL Server实例中,并把该身份验证信 ...

  9. The xp_cmdshell proxy account information cannot be retrieved or is invalid. Verify that the '##xp_cmdshell_proxy_account##' credential exists and contains valid information.

    In one of our recent migrations, we got the following error when the client tried to fire xp_cmdshel ...

随机推荐

  1. java8新增的日期时间包

    Clock clock=Clock.systemUTC(); System.out.println("当前时刻为:"+clock.instant()); System.out.pr ...

  2. couldn't connect to host

    “couldn't connect to host” 这样的错误可能是主机不可到达,或者端口不可到达. ping OK只代表主机可以到达. 端口不可到达可能是由于HTTP 服务器未启动或者监听在其他端 ...

  3. 基于ArcGIS for Server的服务部署分析 分类: ArcGIS for server 云计算 2015-07-26 21:28 11人阅读 评论(0) 收藏

    谨以此纪念去年在学海争锋上的演讲. ---------------------------------------------------- 基于ArcGIS for Server的服务部署分析 -- ...

  4. mysql-blog

    https://www.cnblogs.com/zhanht/p/5450559.html

  5. Python开发【前端】:Ajax(一)

    Ajax Ajax即“Asynchronous Javascript And XML”(异步JavaScript和XML),是指一种创建交互式网页应用的网页开发技术,AJAX = 异步 JavaScr ...

  6. macOS Sierra 10.12版本 显示隐藏文件

    1.显示隐藏文件 打开Terminal 输入:defaults write com.apple.finder AppleShowAllFiles -bool true 再输入: killall Fin ...

  7. .NET、NET Framewor以及.NET Core的关系(二)

    什么是CLR,.NET虚拟机? 实际上,.NET不仅提供了自动内存管理的支持,他还提供了一些列的如类型安全.应用程序域.异常机制等支持,这些 都被统称为CLR公共语言运行库. CLR是.NET类型系统 ...

  8. 关于使用ubuntu的那些事儿

    最近把笔记本的系统由windows改成了ubuntu的最新版系统了,其实改变系统最主要的目的就是希望自己能够快速的学会使用linux系统. 所以这是一篇记录了关于一个ubuntu小白第一次使用ubun ...

  9. 198. House Robber(动态规划)

    198. House Robber You are a professional robber planning to rob houses along a street. Each house ha ...

  10. flask后端 获取不到form表单post 的文件

    原文地址http://docs.jinkan.org/docs/flask/patterns/fileuploads.html <form> 标签被标记有 enctype=multipar ...