forked from ms4720/s3sync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
s3config.rb
27 lines (23 loc) · 1000 Bytes
/
s3config.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/ruby
# This software code is made available "AS IS" without warranties of any
# kind. You may copy, display, modify and redistribute the software
# code either by itself or as incorporated into your code; provided that
# you do not remove any proprietary notices. Your use of this software
# code is at your own risk and you waive any claim against the author
# with respect to your use of this software code.
# (c) 2007 alastair brunton
#
# modified to search out the yaml in several places, thanks wkharold.
require 'yaml'
module S3Config
confpath = ["#{ENV['S3CONF']}", "#{ENV['HOME']}/.s3conf", "/etc/s3conf"]
confpath.each do |path|
if File.exists?(path) and File.directory?(path) and File.exists?("#{path}/s3config.yml")
config = YAML.load_file("#{path}/s3config.yml")
config.each_pair do |key, value|
eval("$#{key.upcase} = '#{value}'")
end
break
end
end
end