gitlab_config 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85c6e0db3c13ade3272112004bd02465c18e20a4
4
- data.tar.gz: df928cd034c6d1b7f578eb9f91441e167296d248
3
+ metadata.gz: ad58d1f4364fab9f0a1e4a5f2968f05823ab9786
4
+ data.tar.gz: 5101fbc33845cc39a5b2e1ae7638d3ac2e7f1522
5
5
  SHA512:
6
- metadata.gz: 616eafe77e7baa9605f553cad3c8f2b4912fc0068d14c9d1fcc1b804d29c7979093d3475c90fae7599bf9c8c9d89f5c4ce2d65a1b9e09ed5165160f84647ca01
7
- data.tar.gz: f63513444e2eeaf5b6c9e038771b254cc08f014877e09397988c6eb391bc9455d29721f72d982432740a102e659a43582da9f4a9f035d8bff9fbe8b75de58792
6
+ metadata.gz: 94da9bec314957fcef85cdebdb2f599e6bb2240e375579a4a8552708da041ed5df59dda04f3d4904311efa0adb5d49de513bcbf6852a6eb39989a79a5ea714f7
7
+ data.tar.gz: 68d4dc9fc4a52c2363d29d9ba8bb8f95761eabedb4443ca43dd506faa4e77c6c1a86431b2beefac691d4fb15725ad36349626009682c7837816f99980f72953b
@@ -24,7 +24,7 @@ module GitlabConfig
24
24
  when :custom
25
25
  @options.fetch(:config_source)
26
26
  when :s3
27
- S3ConfigurationSource.new(@options.fetch(:region), iam)
27
+ S3ConfigurationSource.new(@options)
28
28
  when :local
29
29
  LocalSource.new
30
30
  else
@@ -9,8 +9,11 @@ module GitlabConfig
9
9
 
10
10
  attr_reader :region, :iam
11
11
 
12
- def initialize(region, iam)
13
- @region, @iam = region, iam
12
+ def initialize(config)
13
+ @region = config.fetch(:region)
14
+ @iam = config.fetch(:iam, nil)
15
+ @role_arn = config.fetch(:arn, nil)
16
+ @role_session = config.fetch(:session, nil)
14
17
  end
15
18
 
16
19
  # Get configuration will download the file read it
@@ -30,7 +33,19 @@ module GitlabConfig
30
33
  end
31
34
 
32
35
  def credentials
33
- Aws::Credentials.new(@iam.key, @iam.secret)
36
+ unless @role_arn.nil?
37
+ return Aws::AssumeRoleCredentials.new(
38
+ client: Aws::STS::Client.new,
39
+ role_arn: @role_arn,
40
+ role_session_name: @role_session
41
+ )
42
+ end
43
+
44
+ unless @iam.nil?
45
+ return Aws::Credentials.new(@iam.key, @iam.secret)
46
+ end
47
+
48
+ raise 'AWS credentials not available'
34
49
  end
35
50
 
36
51
  end
@@ -1,3 +1,3 @@
1
1
  module GitlabConfig
2
- VERSION = "0.3.2"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Tarry