Skip to content

Commit 406b720

Browse files
committed
Made a few available_options optional (will squash later)
I read the code from https://github.com/fastlane/fastlane/blob/master/fastlane_core/lib/fastlane_core/configuration/config_item.rb and tried to modernize the available_options.
1 parent c2e3503 commit 406b720

File tree

1 file changed

+29
-10
lines changed

1 file changed

+29
-10
lines changed

lib/fastlane/plugin/aws_sns/actions/aws_sns_action.rb

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,22 +151,38 @@ def self.available_options
151151
FastlaneCore::ConfigItem.new(key: :access_key,
152152
env_name: "AWS_SNS_ACCESS_KEY",
153153
description: "AWS Access Key ID",
154-
optional: false,
155-
default_value: ENV['AWS_ACCESS_KEY_ID']),
154+
optional: true,
155+
sensitive: true,
156+
conflicting_options: [:aws_sns_client],
157+
conflict_block: proc do |value|
158+
UI.user_error!("You can't use option '#{value.key}' along with 'access_key'")
159+
end),
156160
FastlaneCore::ConfigItem.new(key: :secret_access_key,
157161
env_name: "AWS_SNS_SECRET_ACCESS_KEY",
158162
description: "AWS Secret Access Key",
159-
optional: false,
160-
default_value: ENV['AWS_SECRET_ACCESS_KEY']),
163+
optional: true,
164+
sensitive: true,
165+
conflicting_options: [:aws_sns_client],
166+
conflict_block: proc do |value|
167+
UI.user_error!("You can't use option '#{value.key}' along with 'secret_access_key'")
168+
end),
161169
FastlaneCore::ConfigItem.new(key: :region,
162170
env_name: "AWS_SNS_REGION",
163171
description: "AWS Region",
164-
optional: false,
165-
default_value: ENV['AWS_REGION']),
172+
optional: true,
173+
sensitive: true,
174+
conflicting_options: [:aws_sns_client],
175+
conflict_block: proc do |value|
176+
UI.user_error!("You can't use option '#{value.key}' along with 'region'")
177+
end),
166178
FastlaneCore::ConfigItem.new(key: :aws_sns_client,
167179
description: "AWS SNS Client, useful in case of special credentials or custom logging",
168-
is_string: false,
169-
optional: true),
180+
type: Aws::SNS::Client,
181+
optional: true,
182+
conflicting_options: [:access_key, :secret_access_key, :region],
183+
conflict_block: proc do |value|
184+
UI.user_error!("You can't use option '#{value.key}' along with 'aws_sns_client'")
185+
end),
170186
FastlaneCore::ConfigItem.new(key: :platform,
171187
env_name: "AWS_SNS_PLATFORM",
172188
description: "AWS Platform",
@@ -186,16 +202,19 @@ def self.available_options
186202
env_name: "AWS_SNS_PLATFORM_APNS_PRIVATE_KEY_PASSWORD",
187203
description: "AWS Platform APNS Private Key Password",
188204
optional: true,
205+
sensitive: true,
189206
default_value: ""),
190207
FastlaneCore::ConfigItem.new(key: :platform_fcm_server_key,
191208
env_name: "AWS_SNS_PLATFORM_FCM_SERVER_KEY",
192209
description: "AWS Platform FCM SERVER KEY",
193-
optional: true),
210+
optional: true,
211+
sensitive: true),
194212
FastlaneCore::ConfigItem.new(key: :platform_gcm_api_key,
195213
env_name: "AWS_SNS_PLATFORM_GCM_API_KEY",
196214
description: "AWS Platform GCM API KEY",
197215
deprecated: "Use :platform_fcm_server_key instead",
198-
optional: true),
216+
optional: true,
217+
sensitive: true),
199218
FastlaneCore::ConfigItem.new(key: :update_if_exists,
200219
env_name: "AWS_SNS_UDPATE_IF_EXISTS",
201220
description: "updating certificate/key if platform_name already exists",

0 commit comments

Comments
 (0)