Module: SecretServer::Configuration

Included in:
SdkClient
Defined in:
lib/secret_server/configuration.rb

Overview

Helpers for working with the Secret Server configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#keyObject

Returns the value of attribute key.



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

def key
  @key
end

#pathObject

Returns the value of attribute path.



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

def path
  @path
end

#ruleObject

Returns the value of attribute rule.



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

def rule
  @rule
end

#urlObject

Returns the value of attribute url.



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

def url
  @url
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



6
7
8
# File 'lib/secret_server/configuration.rb', line 6

def configure
  yield self
end

#env_configureObject



10
11
12
13
14
15
16
17
# File 'lib/secret_server/configuration.rb', line 10

def env_configure
  configure do |config|
    config.path = ENV['SDK_CLIENT_PATH'] || nil
    config.url = ENV['SECRET_SERVER_URL'] || nil
    config.rule = ENV['SDK_CLIENT_RULE'] || nil
    config.key = ENV['SDK_CLIENT_KEY'] || nil
  end
end

#tssObject



27
28
29
30
31
32
33
34
# File 'lib/secret_server/configuration.rb', line 27

def tss
  return @tss if defined? @tss
  @tss = begin
    bin = File.join(path, 'tss.exe')
    bin = File.join(path, 'tss') unless File.exist? bin
    bin
  end
end

#valid_path?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/secret_server/configuration.rb', line 19

def valid_path?
  File.exist? tss
end

#valid_url?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/secret_server/configuration.rb', line 23

def valid_url?
  !url.nil?
end