首页 > 解决方案 > 为 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 } %>

在这些领域中的最佳实践是什么?并假设它不是纯文本,它们最好存储在哪里/如何存储?

标签: ruby-on-railsdatabasesecuritysmtppasswords

解决方案


推荐阅读