diff options
author | elijah <elijah@riseup.net> | 2015-05-05 15:22:21 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2015-05-05 15:22:21 -0700 |
commit | 81e4dde40f8ad483df0c6ba87da1a3ba480eb7f4 (patch) | |
tree | 7223d1b9a25d809ffb2bc06c758107b9030c1582 /provider_base/lib/macros | |
parent | 6c52774056af7a54cb07704dc25415df7ff06737 (diff) |
much faster secret generation (now they only get generated when needed)
Diffstat (limited to 'provider_base/lib/macros')
-rw-r--r-- | provider_base/lib/macros/secrets.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/provider_base/lib/macros/secrets.rb b/provider_base/lib/macros/secrets.rb index 51bf3971..8d1feb55 100644 --- a/provider_base/lib/macros/secrets.rb +++ b/provider_base/lib/macros/secrets.rb @@ -13,17 +13,17 @@ module LeapCli # +length+ is the character length of the generated password. # def secret(name, length=32) - @manager.secrets.set(name, Util::Secret.generate(length), @node[:environment]) + manager.secrets.set(name, @node.environment) { Util::Secret.generate(length) } end # inserts a base32 encoded secret def base32_secret(name, length=20) - @manager.secrets.set(name, Base32.encode(Util::Secret.generate(length)), @node[:environment]) + manager.secrets.set(name, @node.environment) { Base32.encode(Util::Secret.generate(length)) } end # Picks a random obfsproxy port from given range def rand_range(name, range) - @manager.secrets.set(name, rand(range), @node[:environment]) + manager.secrets.set(name, @node.environment) { rand(range) } end # @@ -32,7 +32,7 @@ module LeapCli # +bit_length+ is the bits in the secret, (ie length of resulting hex string will be bit_length/4) # def hex_secret(name, bit_length=128) - @manager.secrets.set(name, Util::Secret.generate_hex(bit_length), @node[:environment]) + manager.secrets.set(name, @node.environment) { Util::Secret.generate_hex(bit_length) } end end |