Class: RosettAi::Config::MaskingSecretResolver
- Inherits:
-
Object
- Object
- RosettAi::Config::MaskingSecretResolver
- Defined in:
- lib/rosett_ai/config/masking_secret_resolver.rb
Overview
Drop-in replacement for SecretResolver that masks all secret values
instead of resolving them. Used by config show to display compiled
JSON without exposing sensitive data.
Follows the same interface as SecretResolver (resolve, resolve_all) and uses the same deterministic string parsing — no regex.
Constant Summary collapse
- MASKED_VALUE =
Returns Placeholder string replacing resolved secrets in output.
'***'
Instance Method Summary collapse
-
#resolve(value) ⇒ String
Resolve the value for the given key.
-
#resolve_all(obj) ⇒ Hash
Resolve all secret references in the given hash.
Instance Method Details
#resolve(value) ⇒ String
Resolve the value for the given key.
22 23 24 25 26 27 |
# File 'lib/rosett_ai/config/masking_secret_resolver.rb', line 22 def resolve(value) return value unless value.is_a?(String) return value unless secret_reference?(value) MASKED_VALUE end |
#resolve_all(obj) ⇒ Hash
Resolve all secret references in the given hash.
33 34 35 36 37 38 39 40 |
# File 'lib/rosett_ai/config/masking_secret_resolver.rb', line 33 def resolve_all(obj) case obj when Hash then obj.transform_values { |v| resolve_all(v) } when Array then obj.map { |v| resolve_all(v) } when String then resolve(obj) else obj end end |