class Cumulus::Configuration
Public: Contains the configuration values set in the configuration.json file. Provides a Singleton that can be accessed throughout the application.
Attributes
Public Class Methods
Public: Initialize the Configuration
Singleton. Must be called before any access to `Configuration.instance` is used.
conf_dir - The String path to the directory the configuration can be found in profile - The String profile name that will be used to make AWS API calls assume_role - The ARN of the role to assume when making AWS API calls autoscaling_force_size
- Determines whether autoscaling should use configured values for min/max/desired group size
# File lib/conf/Configuration.rb, line 142 def init(conf_dir, profile, assume_role, autoscaling_force_size) instance = new(conf_dir, profile, assume_role, autoscaling_force_size) @@instance = instance end
Public: The Singleton instance of Configuration
.
Returns the Configuration
instance.
# File lib/conf/Configuration.rb, line 150 def instance @@instance end
Private Class Methods
Internal: Constructor. Sets up the `instance` variable, which is the access point for the Singleton.
conf_dir - The String path to the directory the configuration can be found in profile - The String profile name that will be used to make AWS API calls assume_role - The ARN of the role to assume when making AWS API calls autoscaling_force_size
- Determines whether autoscaling should use configured values for min/max/desired group size
# File lib/conf/Configuration.rb, line 100 def initialize(conf_dir, profile, assume_role, autoscaling_force_size) Config.conf_dir = conf_dir; Config.json = JSON.parse(File.read(absolute_path("configuration.json"))) @colors_enabled = conf "colors-enabled" @iam = IamConfig.new @autoscaling = AutoScalingConfig.new(autoscaling_force_size) @route53 = Route53Config.new @security = SecurityConfig.new @cloudfront = CloudFrontConfig.new @s3 = S3Config.new @elb = ELBConfig.new @vpc = VpcConfig.new @kinesis = KinesisConfig.new @sqs = SQSConfig.new @ec2 = EC2Config.new region = conf "region" credentials = if assume_role Aws::AssumeRoleCredentials.new( client: Aws::STS::Client.new(profile: profile, region: region), role_arn: assume_role, role_session_name: "#{region}-#{@profile}" ) end @client = { :region => region, :profile => profile, :credentials => credentials, }.reject { |_, v| v.nil? } end