Class: Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/prefix_api_key/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



6
7
8
9
10
11
# File 'lib/prefix_api_key/configuration.rb', line 6

def initialize
  @salt_short = ENV.fetch('SALT_SHORT', nil)
  @salt_long = ENV.fetch('SALT_LONG', nil)
  @password_short = ENV.fetch('PASSWORD_SHORT', nil)
  @password_long = ENV.fetch('PASSWORD_LONG', nil)
end

Instance Attribute Details

#password_longObject

Returns the value of attribute password_long.



4
5
6
# File 'lib/prefix_api_key/configuration.rb', line 4

def password_long
  @password_long
end

#password_shortObject

Returns the value of attribute password_short.



4
5
6
# File 'lib/prefix_api_key/configuration.rb', line 4

def password_short
  @password_short
end

#salt_longObject

Returns the value of attribute salt_long.



4
5
6
# File 'lib/prefix_api_key/configuration.rb', line 4

def salt_long
  @salt_long
end

#salt_shortObject

Returns the value of attribute salt_short.



4
5
6
# File 'lib/prefix_api_key/configuration.rb', line 4

def salt_short
  @salt_short
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)

Raises:

  • (StandardError)


13
14
15
16
17
# File 'lib/prefix_api_key/configuration.rb', line 13

def valid?
  raise StandardError, 'Missing configuration environment' if @salt_short.nil? || @salt_long.nil? || @password_short.nil? || @password_long.nil?

  true
end