Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 640315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:56:23+00:00 2026-05-13T20:56:23+00:00

Am I crazy, or is it a bad idea to keep my SMTP username

  • 0

Am I crazy, or is it a bad idea to keep my SMTP username and password for ActionMailer in the actual (development/production) config file? It seems like I should store it an encrypted place, or at the very minimum, exclude it from my Mercurial pushes.

Right now, I’m just removing the password from my source file before performing a push, but there’s got to be a smarter way than the one I’m using. 🙂

Perhaps I should store it in my database as another user (which is already stored with encrypted passwords) and fetch it programatically?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:56:24+00:00Added an answer on May 13, 2026 at 8:56 pm

    Use an application configuration file that is not stored in your repository for storing sensitive information. Here is how I’ve done it:

    1. Add an app_config.yml in your config directory. Its contents would look like this:

      smtp_password: kl240jvfslkr32rKgjlk
      some_other_password: 34hg9r0j0g402jg
      and_so_on: lkn$@gJkjgsFLK4gaj
      
    2. Add a preinitializer.rb in your config directory with the following contents:

      require 'yaml'
      APP_CONFIG = YAML.load(File.read(RAILS_ROOT + "/config/app_config.yml"))
      
    3. Substitute your passwords for values in the APP_CONFIG variable, like so:

      smtp_password = kl240jvfslkr32rKgjlk # old version
      smtp_password = APP_CONFIG['smtp_password'] # new version
      

    Make sure you don’t include app_config.yml in your repository, though you may want to create an example file that is checked in, just to show a sample of what should be in it. When you deploy your application, make sure that app_config.yml is stored on the server. If you’re using a standard Capistrano deployment, put the file in the shared folder and update your deployment task to create a symlink to it in the current release’s directory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Crazy right? Sample code: <?php session_start(); $hostname=samplehost; $username=sampleuser; $password=samplepass; $dbname=sampledb; $link = mysql_connect($hostname, $username,
This is driving me crazy. I have this one php file on a test
What?! I know, what a bad idea. Firstly I have no control over the
You probably think I am completely crazy and terribly bad at programming. One of
A crazy question: Imagine a webpage file called somepage.php And it contains some html
I'm not really fascinated by TabView in Android. So I've got a crazy idea
Crazy question...however, I want the sum of all the rows in a table for
Wow crazy title! But here's the problem. In efforts to dry up my school
I'm getting crazy with getting my table look right on different browsers, just when
This is driving me crazy. I'm not going to take it anymore. I'm going

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.