Class: CodeBuildNotifier::Config
- Inherits:
-
Object
- Object
- CodeBuildNotifier::Config
- Defined in:
- lib/codebuild-notifier/config.rb
Constant Summary collapse
- DEFAULT_WHITELIST =
%w[master release]
Instance Attribute Summary collapse
-
#additional_channel ⇒ Object
readonly
Returns the value of attribute additional_channel.
-
#dynamo_table ⇒ Object
readonly
Returns the value of attribute dynamo_table.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#slack_admins ⇒ Object
readonly
Returns the value of attribute slack_admins.
-
#slack_secret_name ⇒ Object
readonly
Returns the value of attribute slack_secret_name.
-
#whitelist_branches ⇒ Object
readonly
Returns the value of attribute whitelist_branches.
Instance Method Summary collapse
-
#initialize(additional_channel: ENV['CBN_ADDITIONAL_CHANNEL'], dynamo_table: ENV['CBN_DYNAMO_TABLE'] || 'branch-build-status', region: ENV['CBN_AWS_REGION'] || ENV['AWS_REGION'], slack_admins: ENV['CBN_SLACK_ADMIN_USERNAMES'], slack_secret_name: ENV['CBN_SLACK_SECRET_NAME'] || 'slack/codebuild', whitelist_branches: ENV['CBN_WHITELIST_BRANCHES']) ⇒ Config
constructor
Configuration values specific to CodeBuild Notifier.
-
#non_pr_branch_ids ⇒ Object
Match the format of the CodeBuild trigger variable.
- #whitelist ⇒ Object
Constructor Details
#initialize(additional_channel: ENV['CBN_ADDITIONAL_CHANNEL'], dynamo_table: ENV['CBN_DYNAMO_TABLE'] || 'branch-build-status', region: ENV['CBN_AWS_REGION'] || ENV['AWS_REGION'], slack_admins: ENV['CBN_SLACK_ADMIN_USERNAMES'], slack_secret_name: ENV['CBN_SLACK_SECRET_NAME'] || 'slack/codebuild', whitelist_branches: ENV['CBN_WHITELIST_BRANCHES']) ⇒ Config
Configuration values specific to CodeBuild Notifier. CBN_ prefix is used because ENV vars with CODEBUILD_ prefix are reserved for use by AWS.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/codebuild-notifier/config.rb', line 27 def initialize( additional_channel: ENV['CBN_ADDITIONAL_CHANNEL'], dynamo_table: ENV['CBN_DYNAMO_TABLE'] || 'branch-build-status', region: ENV['CBN_AWS_REGION'] || ENV['AWS_REGION'], slack_admins: ENV['CBN_SLACK_ADMIN_USERNAMES'], slack_secret_name: ENV['CBN_SLACK_SECRET_NAME'] || 'slack/codebuild', whitelist_branches: ENV['CBN_WHITELIST_BRANCHES'] ) @additional_channel = additional_channel @dynamo_table = dynamo_table @region = region @slack_admins = slack_admins&.split(',') || [] @slack_secret_name = slack_secret_name @whitelist_branches = whitelist_branches&.split(',') || DEFAULT_WHITELIST end |
Instance Attribute Details
#additional_channel ⇒ Object (readonly)
Returns the value of attribute additional_channel.
22 23 24 |
# File 'lib/codebuild-notifier/config.rb', line 22 def additional_channel @additional_channel end |
#dynamo_table ⇒ Object (readonly)
Returns the value of attribute dynamo_table.
22 23 24 |
# File 'lib/codebuild-notifier/config.rb', line 22 def dynamo_table @dynamo_table end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
22 23 24 |
# File 'lib/codebuild-notifier/config.rb', line 22 def region @region end |
#slack_admins ⇒ Object (readonly)
Returns the value of attribute slack_admins.
22 23 24 |
# File 'lib/codebuild-notifier/config.rb', line 22 def slack_admins @slack_admins end |
#slack_secret_name ⇒ Object (readonly)
Returns the value of attribute slack_secret_name.
22 23 24 |
# File 'lib/codebuild-notifier/config.rb', line 22 def slack_secret_name @slack_secret_name end |
#whitelist_branches ⇒ Object (readonly)
Returns the value of attribute whitelist_branches.
22 23 24 |
# File 'lib/codebuild-notifier/config.rb', line 22 def whitelist_branches @whitelist_branches end |
Instance Method Details
#non_pr_branch_ids ⇒ Object
Match the format of the CodeBuild trigger variable
44 45 46 |
# File 'lib/codebuild-notifier/config.rb', line 44 def non_pr_branch_ids whitelist_branches.map { |name| "branch/#{name}" } end |
#whitelist ⇒ Object
48 49 50 |
# File 'lib/codebuild-notifier/config.rb', line 48 def whitelist whitelist_branches.join(', ') end |