ruby-on-rails - 为 Rails 应用程序存储密码的最佳做法是什么?
问题描述
为所有环境配置文件存储以下字段(用户名,密码)的用户名/密码的最佳方法是什么
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'gmail.com',
user_name: ENV["GMAIL_USERNAME"],
password: ENV["GMAIL_PASSWORD"],
authentication: :plain,
enable_starttls_auto: true
}
或在 database.yml 中(用户名、密码)
default: &default
adapter: postgresql
host: 127.0.0.1
username: postgres
password: postgres
encoding: unicode
# For details on connection pooling, see Rails configuration guide
# https://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
在这些领域中的最佳实践是什么?并假设它不是纯文本,它们最好存储在哪里/如何存储?
解决方案
推荐阅读
- macos - VSCode Mac, extra characters in debug console
- c - 前缀运算符在 C 中未按预期工作
- docker - After InfluxDB docker container restarted it's not restoring to the last point and it have mount volume as well
- java - 正则表达式中是否有任何 NOT 运算符
- ios - Not able to convert date to Today or Yesterday using date formatter in Swift
- python - 在流式传输数据时并行运行代码块
- office365 - 如何启用在 SharePoint 默认列表视图中显示动态创建列
- python - 应该使用 Pandas 或 Sklearn 进行插补/归一化等吗?
- acumatica - 在 Acumatica 中按事件动态更改 PXSelector
- python - for i in range(len(val)): TypeError: 'numpy.float64' 类型的对象没有 len()