Skip to content

Instantly share code, notes, and snippets.

@brgnepal
Created May 27, 2015 10:44
Show Gist options
  • Save brgnepal/6696ba586d780dad07c8 to your computer and use it in GitHub Desktop.
Save brgnepal/6696ba586d780dad07c8 to your computer and use it in GitHub Desktop.
Setting database config params from config file in Sinatra
DB_CONFIG = YAML.load(File.open('config/database.yml'))
EXCEPTIONS = ['[email protected]', '[email protected]']
LDAP = Ldap.setup
set :public_folder, 'public'
db_config = <<END
mysql2://#{DB_CONFIG['username']}:\
#{DB_CONFIG['password']}@#{DB_CONFIG['host']}:\
#{DB_CONFIG['port']}/#{DB_CONFIG['database']}
END
set :database, db_config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment