1

I wan't to make sure my http_basic_authenticate_with username and password isn't floating around since if i add it to get hub it would be displayed. I thought of doing something similar to this

http_basic_authenticate_with :name => Project.admin_user, :password => Project.admin_password, :only => ['edit', 'destroy', 'new']

def self.admin_password
    authentication_file = File.open("/home/mika/Desktop/authentication.txt", "r")
    authentication_file.each_line do |line|
      if  line =~ /\APassword: /
        @password = line[10, line.length - 11 ]
      end
    end
    return @password
  end

  def self.admin_password
    authentication_file = File.open("/home/mika/Desktop/authentication.txt", "r")
    authentication_file.each_line do |line|
      if line =~ /\AUser: /
        @user = line[6, line.length - 7]
      end
    end
    return @user
  end

but this requires the authentication.txt. What's the best way I can add this to my website without my username and password floating around (Since its just me using this website its impractical to add a new model just for this no?)

MikaAK
  • 2,334
  • 6
  • 26
  • 53

1 Answers1

1

I'd recommend just looking around at how Rails config variables can be set and used

This quetion has a short and sweet example. There are really a million ways to do it, but you just have to pick one and go with it.

Community
  • 1
  • 1
Tom Prats
  • 7,364
  • 9
  • 47
  • 77