Class: Bindings::ConfigTreeBinding
- Inherits:
-
Object
- Object
- Bindings::ConfigTreeBinding
- Includes:
- Binding
- Defined in:
- lib/binding.rb
Overview
An implementation of Bindings::Binding that reads files from a volume mounted Kubernetes Secret: kubernetes.io/docs/concepts/configuration/secret/#using-secrets
Instance Method Summary collapse
-
#get_as_bytes(key) ⇒ Array<Integer>?
Returns the contents of a binding entry in its raw bytes form.
-
#initialize(root) ⇒ ConfigTreeBinding
constructor
Creates a new instance.
-
#name ⇒ String
Returns the name of the binding.
Methods included from Binding
Constructor Details
#initialize(root) ⇒ ConfigTreeBinding
Creates a new instance.
123 124 125 |
# File 'lib/binding.rb', line 123 def initialize(root) @root = root end |
Instance Method Details
#get_as_bytes(key) ⇒ Array<Integer>?
Returns the contents of a binding entry in its raw bytes form.
132 133 134 135 136 137 138 139 140 |
# File 'lib/binding.rb', line 132 def get_as_bytes(key) return nil unless Bindings.valid_secret_key?(key) p = File.join(@root, key) return nil unless File.exist?(p) && File.file?(p) File.read(p, mode: "rb").bytes end |
#name ⇒ String
Returns the name of the binding
145 146 147 |
# File 'lib/binding.rb', line 145 def name File.basename(@root) end |