Class: Moonshot::ControllerConfig
- Inherits:
-
Object
- Object
- Moonshot::ControllerConfig
- Defined in:
- lib/moonshot/controller_config.rb
Overview
Holds configuration for Moonshot::Controller
Instance Attribute Summary collapse
-
#account_alias ⇒ Object
readonly
Returns the value of attribute account_alias.
-
#additional_tag ⇒ Object
Returns the value of attribute additional_tag.
-
#answer_file ⇒ Object
Returns the value of attribute answer_file.
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#artifact_repository ⇒ Object
Returns the value of attribute artifact_repository.
-
#build_mechanism ⇒ Object
Returns the value of attribute build_mechanism.
-
#changeset_wait_time ⇒ Object
Returns the value of attribute changeset_wait_time.
-
#default_parameter_source ⇒ Object
Returns the value of attribute default_parameter_source.
-
#deployment_mechanism ⇒ Object
Returns the value of attribute deployment_mechanism.
-
#dev_build_name_proc ⇒ Object
Returns the value of attribute dev_build_name_proc.
-
#environment_name ⇒ Object
Returns the value of attribute environment_name.
-
#extra_tags ⇒ Object
Returns the value of attribute extra_tags.
-
#interactive ⇒ Object
Returns the value of attribute interactive.
-
#interactive_logger ⇒ Object
Returns the value of attribute interactive_logger.
-
#parameter_overrides ⇒ Object
Returns the value of attribute parameter_overrides.
-
#parameter_sources ⇒ Object
Returns the value of attribute parameter_sources.
-
#parameters ⇒ Object
Returns the value of attribute parameters.
-
#parent_stacks ⇒ Object
Returns the value of attribute parent_stacks.
-
#plugins ⇒ Object
Returns the value of attribute plugins.
-
#project_root ⇒ Object
Returns the value of attribute project_root.
-
#show_all_stack_events ⇒ Object
Returns the value of attribute show_all_stack_events.
-
#ssh_auto_scaling_group_name ⇒ Object
Returns the value of attribute ssh_auto_scaling_group_name.
-
#ssh_command ⇒ Object
Returns the value of attribute ssh_command.
-
#ssh_config ⇒ Object
Returns the value of attribute ssh_config.
-
#ssh_instance ⇒ Object
Returns the value of attribute ssh_instance.
-
#template_file ⇒ Object
Returns the value of attribute template_file.
-
#template_s3_bucket ⇒ Object
Returns the value of attribute template_s3_bucket.
Instance Method Summary collapse
- #in_account(name, &blk) ⇒ Object
-
#initialize ⇒ ControllerConfig
constructor
A new instance of ControllerConfig.
- #update_for_account! ⇒ Object
Constructor Details
#initialize ⇒ ControllerConfig
Returns a new instance of ControllerConfig.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/moonshot/controller_config.rb', line 15 def initialize @default_parameter_source = AskUserSource.new @interactive = true @interactive_logger = InteractiveLogger.new @parameter_overrides = {} @parameter_sources = {} @parameters = ParameterCollection.new @parent_stacks = [] @account_alias = nil @per_account_config = {} @plugins = [] @project_root = Dir.pwd @show_all_stack_events = false @ssh_config = SSHConfig.new @extra_tags = [] @dev_build_name_proc = lambda do |c| ['dev', c.app_name, c.environment_name, Time.now.to_i].join('/') end user = ENV.fetch('USER', 'default-user').gsub(/\W/, '') @environment_name = "dev-#{user}" end |
Instance Attribute Details
#account_alias ⇒ Object (readonly)
Returns the value of attribute account_alias.
6 7 8 |
# File 'lib/moonshot/controller_config.rb', line 6 def account_alias @account_alias end |
#additional_tag ⇒ Object
Returns the value of attribute additional_tag.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def additional_tag @additional_tag end |
#answer_file ⇒ Object
Returns the value of attribute answer_file.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def answer_file @answer_file end |
#app_name ⇒ Object
Returns the value of attribute app_name.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def app_name @app_name end |
#artifact_repository ⇒ Object
Returns the value of attribute artifact_repository.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def artifact_repository @artifact_repository end |
#build_mechanism ⇒ Object
Returns the value of attribute build_mechanism.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def build_mechanism @build_mechanism end |
#changeset_wait_time ⇒ Object
Returns the value of attribute changeset_wait_time.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def changeset_wait_time @changeset_wait_time end |
#default_parameter_source ⇒ Object
Returns the value of attribute default_parameter_source.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def default_parameter_source @default_parameter_source end |
#deployment_mechanism ⇒ Object
Returns the value of attribute deployment_mechanism.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def deployment_mechanism @deployment_mechanism end |
#dev_build_name_proc ⇒ Object
Returns the value of attribute dev_build_name_proc.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def dev_build_name_proc @dev_build_name_proc end |
#environment_name ⇒ Object
Returns the value of attribute environment_name.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def environment_name @environment_name end |
#extra_tags ⇒ Object
Returns the value of attribute extra_tags.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def @extra_tags end |
#interactive ⇒ Object
Returns the value of attribute interactive.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def interactive @interactive end |
#interactive_logger ⇒ Object
Returns the value of attribute interactive_logger.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def interactive_logger @interactive_logger end |
#parameter_overrides ⇒ Object
Returns the value of attribute parameter_overrides.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def parameter_overrides @parameter_overrides end |
#parameter_sources ⇒ Object
Returns the value of attribute parameter_sources.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def parameter_sources @parameter_sources end |
#parameters ⇒ Object
Returns the value of attribute parameters.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def parameters @parameters end |
#parent_stacks ⇒ Object
Returns the value of attribute parent_stacks.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def parent_stacks @parent_stacks end |
#plugins ⇒ Object
Returns the value of attribute plugins.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def plugins @plugins end |
#project_root ⇒ Object
Returns the value of attribute project_root.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def project_root @project_root end |
#show_all_stack_events ⇒ Object
Returns the value of attribute show_all_stack_events.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def show_all_stack_events @show_all_stack_events end |
#ssh_auto_scaling_group_name ⇒ Object
Returns the value of attribute ssh_auto_scaling_group_name.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def ssh_auto_scaling_group_name @ssh_auto_scaling_group_name end |
#ssh_command ⇒ Object
Returns the value of attribute ssh_command.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def ssh_command @ssh_command end |
#ssh_config ⇒ Object
Returns the value of attribute ssh_config.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def ssh_config @ssh_config end |
#ssh_instance ⇒ Object
Returns the value of attribute ssh_instance.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def ssh_instance @ssh_instance end |
#template_file ⇒ Object
Returns the value of attribute template_file.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def template_file @template_file end |
#template_s3_bucket ⇒ Object
Returns the value of attribute template_s3_bucket.
8 9 10 |
# File 'lib/moonshot/controller_config.rb', line 8 def template_s3_bucket @template_s3_bucket end |
Instance Method Details
#in_account(name, &blk) ⇒ Object
39 40 41 42 43 |
# File 'lib/moonshot/controller_config.rb', line 39 def in_account(name, &blk) # Store account specific configs as lambdas, to be evaluated # if the account name matches during controller execution. @per_account_config[name] = blk end |
#update_for_account! ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/moonshot/controller_config.rb', line 45 def update_for_account! # Evaluated any account-specific configuration. @account_alias = Moonshot::AccountContext.get return unless @account_alias return unless @per_account_config.key?(@account_alias) @per_account_config[@account_alias].call(self) end |