@@ -12,6 +12,7 @@ ACTIONS = {
1212 deploy : 'Deploys a new stack' ,
1313 migrate : 'Migrates from green to blue stack' ,
1414 remove : 'Removes the given deployment' ,
15+ configure : 'Configure the target account in the restacker.yml file' ,
1516 dump : 'Dumps the default configuration for a given template or module' ,
1617 console : 'Opens the AWS Console'
1718}
@@ -116,6 +117,17 @@ begin
116117 puts ( VERSION ) || exit ( 0 ) if options [ :version ]
117118 usage ( "Please specify an ACTION" ) && exit ( 0 ) if action . nil?
118119
120+ if action == 'configure'
121+ plane = options [ :location ] ? options [ :location ] : DEFAULT_PLANE
122+ if !plane
123+ puts "Location not specified, plane is set to default: [#{ DEFAULT_PLANE } ]"
124+ end
125+ puts "Configuring target plane [#{ plane } ]: "
126+ RestackerConfig . load_config ( plane . to_sym )
127+ Restacker . configure ( plane . to_sym )
128+ exit ( 0 )
129+ end
130+
119131 if ACTIONS . keys . push ( :aws ) . include? ( action . to_sym )
120132 restacker = Restacker . new ( options . to_h ) unless [ 'dump' ] . include? ( action )
121133 case action
@@ -158,6 +170,16 @@ begin
158170 else
159171 usage "Please specify a stack name (-n) to remove"
160172 end
173+ # when 'configure'
174+ # plane = ""
175+ # if !options[:location]
176+ # puts "Location not specified, default plane #{DEFAULT_PLANE} used."
177+ # plane = DEFAULT_PLANE
178+ # else
179+ # plane = options[:location]
180+ # end
181+ # puts "Configuring target account for plane [#{plane}]:\n"
182+ # RestackerConfig.rc_configure(options[:location])
161183 when 'dump'
162184 if options [ :template ]
163185 # puts "Dumping stack parameters"
0 commit comments