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
|
# File 'lib/clusterfsck/setup.rb', line 3
def self.config
puts <<-UI
ClusterFsck stores your configuration(s) in an S3 bucket, which must have a globally unique name.
The name will be stored in `#{ClusterFsck::CLUSTER_FSCK_PATHS[2]}` on this machine, and should be placed in
`#{ClusterFsck::CLUSTER_FSCK_PATHS[1]}` on your production box (with a different ENV setting if desired).
It may also be overridden on a per project basis by creating a `#{ClusterFsck::CLUSTER_FSCK_PATHS[0]}`
file in the project root. The bucket and ENV setting are first checked from environment
variables, so you can set the environment to override the files. The bucket is read from CLUSTER_FSCK_BUCKET
and the environment (production, staging, development, etc) is read from CLUSTER_FSCK_ENV.
UI
unless ClusterFsck.config_hash['cluster_fsck_bucket']
set_bucket_name
end
unless ClusterFsck::CredentialGrabber.find
set_aws_keys
end
unless ClusterFsck::S3Methods.s3.buckets[ClusterFsck.config_hash['cluster_fsck_bucket']].exists?
warn_create_bucket
end
ClusterFsck.config_hash['cluster_fsck_env'] ||= ClusterFsck.default_env
File.open(File.expand_path(ClusterFsck::CLUSTER_FSCK_PATHS[2]), 'w') do |f|
f.write(YAML.dump(ClusterFsck.config_hash))
end
ClusterFsck.config_hash['cluster_fsck_bucket']
end
|