(GoRails) Credential
之前的博客: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的更多相关文章
- 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 ...
- 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 ...
- Dynamics Webservice Call with Credential
Dynamics Webservice call with credential /// <summary> ///WebServiceHelper 的摘要说明 /// </summ ...
- Azure 自动化:使用PowerShell Credential连接到Azure
最近在中国版windows azure中新上线的自动化功能, 使用自动化,您可以导入自己的PowerShell脚本,然后设置一个运行计划使得脚本能按计划运行. 在本文中,我们来学习如何使用PowerS ...
- SQL Server 2008 - Cannot set a credential for principal 'sa'.
SQL Server 2008 - Cannot set a credential for principal 'sa'. 很久没有用到SQL Server了,今天有幸在帮同事解决一个SQL Serv ...
- asp.net权限认证:OWIN实现OAuth 2.0 之客户端模式(Client Credential)
asp.net权限认证系列 asp.net权限认证:Forms认证 asp.net权限认证:HTTP基本认证(http basic) asp.net权限认证:Windows认证 asp.net权限认证 ...
- 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权限认证 ...
- 凭证(Credential)
在SQL Server中,凭证(Credential)用于把Windows用户的身份验证信息(在Windows环境下,是Windows 用户名和密码)存储在SQL Server实例中,并把该身份验证信 ...
- 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 ...
随机推荐
- 170707、springboot编程之监控和管理生产环境
spring-boot-actuator模块提供了一个监控和管理生产环境的模块,可以使用http.jmx.ssh.telnet等拉管理和监控应用.审计(Auditing). 健康(health).数据 ...
- C/C++ 开放库
C/C++ 开放库 1.Best C/C++ Network Library 2.A list of open source C++ libraries
- 【ArcGIS for JavaScript api】Clusterlayer聚簇类
1.作用: 聚簇类是用于前端显示优化,使POI点要素显示更为美观.大量的Marker距离太近会引起压盖而对浏览或者操作产生不便,因此,一般在超过1K点的时候,用此类.. 2.使用方式: 1: // c ...
- 使用任意的输入流(InputStream)实例,包括字符串形式的文件路径或者 file:// 的 URL 形式的文件路径来配置
mybatis – MyBatis 3 | 入门 http://www.mybatis.org/mybatis-3/zh/getting-started.html 从 XML 中构建 SqlSessi ...
- 数字签名中公钥和私钥是什么?对称加密与非对称加密,以及RSA的原理
http://baijiahao.baidu.com/s?id=1581684919791448393&wfr=spider&for=pc https://blog.csdn.net/ ...
- Qt::QWindow多窗口争抢置顶状态解决方案
有时候我们会有这种需求,自己的桌面程序需要置顶,但是程序包含了很多窗口,可能我们要求窗口1,2都在其它桌面程序之上,但是窗口1必须随时在窗口2之上. Qt提供的置顶方式是在windowsflags上增 ...
- django的framework优化
1.优化framework的性能,解决restapi调用慢的问题 ①预加载,关联查询时做缓存,序列化前简单调用setup_eager_loading ,这个需要确定sql查询调用情况(根据数据库结构确 ...
- 不登录到MySQL执行SQL语句
mysql -e 不登录到MySQL执行SQL语句 mysql -u root -p -e "SHOW DATABASES"
- JS随机数种子
JS随机数种子 1 试着想一下,如果在某一个场景,我们做一个游戏,用户玩到一半的时候退出了,这样 用户下次进来可以选择继续上一次的进度继续玩,那么现在问题来了:用户玩 的进度以及用户的积分等简单的描述 ...
- 3.12 Templates -- Wrting Helpers(编写辅助器)
一.概述 1. Helpers允许你向你的模板添加超出在Ember中开箱即用的额外的功能.辅助器是最有用的,用于将来自模型和组件的原始值转换成更适合于用户的格式. 2. 例如,假设我们有一个Invoi ...