1 module Coquelicot::Configure
10 user_settings = File.exists?(settings_path) ? load_user_settings : {}
11 default_settings.delete('authentication_method') if user_settings['authentication_method']
12 merged_settings = default_settings.merge(user_settings)
13 if (authm=merged_settings.delete('authentication_method'))
14 authentication_method authm.delete('name'), authm
16 merged_settings.each{|k,v| set k,v }
19 def authentication_method(method,options={})
20 require "coquelicot/auth/#{method}"
21 set :auth_method, method
22 include (eval "Coquelicot::Auth::#{method.to_s.capitalize}")
23 options.each{|k,v| set k,v }
27 'default_expire' => 60,
28 'maximum_expire' => 60 * 24 * 30, # 1 month
29 'gone_period' => 10080,
30 'filename_length' => 20,
31 'random_pass_length' => 16,
33 'additional_css' => '',
34 'depot_path' => Proc.new { File.join(root, 'files') },
35 'authentication_method' => {
36 'name' => 'simplepass',
37 'upload_password' => 'a94a8fe5ccb19ba61c4c0873d391e987982fbbd3'
43 @settings_path ||= File.join(File.dirname(__FILE__),'..','..','conf','settings.yml')
46 def load_user_settings
47 YAML.load(File.read(settings_path))