Class: RrxConfig::Sources::AwsSecretSource

Inherits:
Base
  • Object
show all
Defined in:
lib/rrx_config/sources/aws_secret_source.rb

Defined Under Namespace

Classes: GetAwsSecretError

Constant Summary collapse

SECRET_VARIABLE =
'RRX_AWS_CONFIG_SECRET_NAME'

Instance Method Summary collapse

Instance Method Details

#deleteObject

Test helper

Raises:

  • (NotImplementedError)


35
36
37
38
39
40
# File 'lib/rrx_config/sources/aws_secret_source.rb', line 35

def delete
  raise NotImplementedError unless Rails.env.test?

  RrxConfig.info "Deleting secret #{secret_id}"
  client.delete_secret({ secret_id:, force_delete_without_recovery: true }) rescue nil
end

#readObject



14
15
16
# File 'lib/rrx_config/sources/aws_secret_source.rb', line 14

def read
  read_secret if secret_id
end

#write(value) ⇒ Object

Test helper

Raises:

  • (NotImplementedError)


20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rrx_config/sources/aws_secret_source.rb', line 20

def write(value)
  raise NotImplementedError unless Rails.env.test?

  RrxConfig.info "Writing secret #{secret_id}"
  result = client.create_secret({
                         name:                           secret_id,
                         secret_string:                  value,
                         force_overwrite_replica_secret: true,
                         description:                    'Integration test'
                       })
  RrxConfig.info "Secret created: #{result.arn}"
end