之前的博客: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. 热词统计以及Quartz.net的简单使用

    一.热词统计 方案一: 设计一个表:ID       KeyWord     Count 当用户再输入框中查询的时候,我们就往表中插入数据,在插入之前首先判断是否已经存在keyword,存在的话,让C ...

  2. 奇怪的Visual Studio 2013停止响应问题

    昨天开始遭遇这个问题,今天再次遭遇. 疑似问题发生在写代码的窗口中复制/粘贴时(有待进一步确认触发条件),突然停止响应,出现下面的对话框: 对话框中的文字为: Waiting for a requir ...

  3. Oracle 11g R2 RAC 高可用连接特性

    转自-阿里巴巴许春值 1.scan概念 什么叫 SCAN,SCAN (Single Client Access Name) 是 Oracle 从11g R2 开始推出的,客户端可以通过 SCAN 特性 ...

  4. 快速定位oracle故障-恩墨

    首先我们要明白一点,所谓的故障,意味着相对来讲比较严重.也就是可能比不同的问题要严重一些,比如锁等待. 要能够快速的定位和解决问题,恢复业务正常:首先我们需要了解Oracle的一些常见的故障有哪些. ...

  5. Git学习-->如何通过Shell脚本实现 监控Gitlab备份整个过程并且通过邮件通知得到备份结果?

    一.背景 Git学习–>如何通过Shell脚本自动定时将Gitlab备份文件复制到远程服务器? http://blog.csdn.net/ouyang_peng/article/details/ ...

  6. mysql 数据操作 多表查询 多表连接查询 内连接

    内连接:只连接匹配的行 只取两张表共同的部分,相当于利用where 过滤条件从笛卡尔积结果中筛选出了正确的结果 select * from 左表 inner join 要连接的表 on 条件 #dep ...

  7. Linux下如何执行Shell脚本

    Linux下你可以有两种方式执行Shell脚本: 1.用shell程序执行脚本:根据你的shell脚本的类型,选择shell程序,常用的有sh,bash,tcsh等(一般来说第一行#!/bin/bas ...

  8. 离线状态 Postman不能开启Postman Interceptor解决

    目前的postman插件如果想正常使用,必须安装Postman Interceptor插件,这样才能直接使用chrome浏览器的cookie等信息,否则postman是无法完成老版本的功能的. 直接使 ...

  9. Randcher 2.0部署K8s集群(一)

    环境准备 1.系统版本 CentOS7.5 + docker ee 2.配置阿里云yum源 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirro ...

  10. tcp/udp/socket 端口映射,转发小工具

    1) 利用 Python 的 Socket 端口转发,用于远程维护 https://github.com/knownsec/rtcp 2) 反向端口转发工具 Reverse TCP Port to U ...