9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/s3_swf_upload/s3_config.rb', line 9
def self.load_config
begin
filename = "#{Rails.root}/config/amazon_s3.yml"
buf = IO.read(filename)
expanded = ERB.new(buf).result(binding)
config = YAML.load(expanded)[Rails.env]
if config == nil
raise "Could not load config options for #{Rails.env} from #{filename}."
end
@@access_key_id = config['access_key_id'] || ENV['AWS_ACCESS_KEY_ID']
@@secret_access_key = config['secret_access_key'] || ENV['AWS_SECRET_ACCESS_KEY']
@@bucket = config['bucket']
@@max_file_size = config['max_file_size'] || 5000000000
@@acl = config['acl'] || 'private'
unless @@access_key_id && @@secret_access_key && @@bucket
raise "Please configure your S3 settings in #{filename} before continuing so that S3 SWF Upload can function properly."
end
rescue Errno::ENOENT
end
end
|