之前的博客: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. postgresql----字符串函数与操作符

    函数 返回值类型 描述 示例 结果 string||string text 字符串连接 select 'Post'||'gresql'||' good!'; Postgresql good! stri ...

  2. Uva10917 Walk Through the Forest

    题目链接:https://vjudge.net/problem/UVA-10917 题目意思:Jimmy下班回家要闯过一下森林,劳累一天后在森林中散步是非常惬意的事,所以他打算每天沿着一条不同的路径回 ...

  3. CentOS下LVM逻辑卷管理技术解释

    1.LVM逻辑卷管理技术产生的背景 企业日益变化的存储需要使得传统的磁盘分区存储显得不够灵活 2.磁盘分区存储 对于这样的三个物理分区的话,迟早有一天会被数据填满,因为它是死的,无法进行缩放. 假设下 ...

  4. With all Java versions it is strongly recommended to not use experimental -XX JVM options.

    https://lucene.apache.org/solr/7_6_0//SYSTEM_REQUIREMENTS.html System Requirements Apache Solr runs ...

  5. 如何在chrome上开启WebGL功能和判断目前浏览器是否支持

        1.开启方式: 第一种:打开cmd,切换到Chorme的安装目录,敲入chrome.exe --enable -webgl,回车就会打开一个chrome浏览器窗口: 第二种:找到Chrome浏 ...

  6. django的cache

    使用文件缓存 #settings.py   CACHES = {   'default': {   'BACKEND': 'django.core.cache.backends.filebased.F ...

  7. day18(JDBC事务&连接池介绍&DBUtils工具介绍&BaseServlet作用)

    day18总结 今日思维导图: 今日内容 事务 连接池 ThreadLocal BaseServlet自定义Servlet父类(只要求会用,不要求会写) DBUtils à commons-dbuti ...

  8. editplus的常用快捷键

    小编给大家整理了一些软件的快捷键.http://www.downza.cn/soft/187814.html 创建当前行的副本:Ctrl+J 反转选定文本的大小写:Ctrl+K 选择当前行:Ctrl+ ...

  9. (2.4)DDL增强功能-数据汇总grouping、rollup、cube

    参考:https://www.cnblogs.com/nikyxxx/archive/2012/11/27/2791001.html 1.rollup (1)rollup在group by 子句中使用 ...

  10. Linux相关知识总结

    查看CPU使用情况 查看内存 ps命令显示所有运行中的进程等命令 top 命令用来显示CPU的使用情况free命令用来显示内存的使用情况 select和epoll区别select,poll,epoll ...