Class: Putpaws::ApplicationConfig
- Inherits:
-
Struct
- Object
- Struct
- Putpaws::ApplicationConfig
- Defined in:
- lib/putpaws/application_config.rb
Instance Attribute Summary collapse
-
#build_log_group_prefix ⇒ Object
Returns the value of attribute build_log_group_prefix.
-
#build_project ⇒ Object
Returns the value of attribute build_project.
-
#build_region ⇒ Object
Returns the value of attribute build_region.
-
#cluster ⇒ Object
Returns the value of attribute cluster.
-
#ecs_region ⇒ Object
Returns the value of attribute ecs_region.
-
#log_group_prefix ⇒ Object
Returns the value of attribute log_group_prefix.
-
#log_region ⇒ Object
Returns the value of attribute log_region.
-
#name ⇒ Object
Returns the value of attribute name.
-
#region ⇒ Object
Returns the value of attribute region.
-
#schedules ⇒ Object
Returns the value of attribute schedules.
-
#service ⇒ Object
Returns the value of attribute service.
-
#task_name_prefix ⇒ Object
Returns the value of attribute task_name_prefix.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#build_log_group_prefix ⇒ Object
Returns the value of attribute build_log_group_prefix
5 6 7 |
# File 'lib/putpaws/application_config.rb', line 5 def build_log_group_prefix @build_log_group_prefix end |
#build_project ⇒ Object
Returns the value of attribute build_project
5 6 7 |
# File 'lib/putpaws/application_config.rb', line 5 def build_project @build_project end |
#build_region ⇒ Object
Returns the value of attribute build_region
5 6 7 |
# File 'lib/putpaws/application_config.rb', line 5 def build_region @build_region end |
#cluster ⇒ Object
Returns the value of attribute cluster
5 6 7 |
# File 'lib/putpaws/application_config.rb', line 5 def cluster @cluster end |
#ecs_region ⇒ Object
Returns the value of attribute ecs_region
5 6 7 |
# File 'lib/putpaws/application_config.rb', line 5 def ecs_region @ecs_region end |
#log_group_prefix ⇒ Object
Returns the value of attribute log_group_prefix
5 6 7 |
# File 'lib/putpaws/application_config.rb', line 5 def log_group_prefix @log_group_prefix end |
#log_region ⇒ Object
Returns the value of attribute log_region
5 6 7 |
# File 'lib/putpaws/application_config.rb', line 5 def log_region @log_region end |
#name ⇒ Object
Returns the value of attribute name
5 6 7 |
# File 'lib/putpaws/application_config.rb', line 5 def name @name end |
#region ⇒ Object
Returns the value of attribute region
5 6 7 |
# File 'lib/putpaws/application_config.rb', line 5 def region @region end |
#schedules ⇒ Object
Returns the value of attribute schedules
5 6 7 |
# File 'lib/putpaws/application_config.rb', line 5 def schedules @schedules end |
#service ⇒ Object
Returns the value of attribute service
5 6 7 |
# File 'lib/putpaws/application_config.rb', line 5 def service @service end |
#task_name_prefix ⇒ Object
Returns the value of attribute task_name_prefix
5 6 7 |
# File 'lib/putpaws/application_config.rb', line 5 def task_name_prefix @task_name_prefix end |
Class Method Details
.all ⇒ Object
21 22 23 24 25 26 |
# File 'lib/putpaws/application_config.rb', line 21 def self.all load.map{|k,v| data = v.slice(*self.members) new(data.merge(name: k.to_s)) } end |
.find(name) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/putpaws/application_config.rb', line 28 def self.find(name) application_data = load data = application_data[name.to_sym] return nil unless data data = data.slice(*self.members) new(data.merge({name: name.to_s})) end |
.load(path_prefix: '.putpaws') ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/putpaws/application_config.rb', line 12 def self.load(path_prefix: '.putpaws') @application_data ||= begin path = Pathname.new(path_prefix).join("application.json").to_s data = File.exist?(path) ? JSON.parse(File.read(path), symbolize_names: true).to_h : {} end end |
Instance Method Details
#build_log_command_params ⇒ Object
52 53 54 55 56 57 |
# File 'lib/putpaws/application_config.rb', line 52 def build_log_command_params { region: build_region || region, log_group_prefix: build_log_group_prefix, } end |
#ecs_command_params ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/putpaws/application_config.rb', line 36 def ecs_command_params { region: ecs_region || region, cluster: cluster, # service: service, task_name_prefix: task_name_prefix, } end |
#log_command_params ⇒ Object
45 46 47 48 49 50 |
# File 'lib/putpaws/application_config.rb', line 45 def log_command_params { region: log_region || region, log_group_prefix: log_group_prefix, } end |