fix(gsap-attestor): use HCL JSON mode for SPIRE plugin_data parsing
SPIRE's chart renders plugin_data as JSON via reformat-and-yaml2json, so hclsimple.Decode with "plugin.json" filename triggers HCL v2 JSON mode. Falls back to native HCL for direct testing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
490c813586
commit
646944ab2a
1 changed files with 1 additions and 2 deletions
|
|
@ -2,7 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"sync"
|
||||
|
||||
"github.com/hashicorp/hcl/v2/hclsimple"
|
||||
|
|
@ -42,7 +41,7 @@ func (p *Plugin) Attest(ctx context.Context, req *workloadattestorv1.AttestReque
|
|||
|
||||
func decodeConfig(data string) (GsapAttestorConfig, error) {
|
||||
var cfg GsapAttestorConfig
|
||||
if err := json.Unmarshal([]byte(data), &cfg); err != nil {
|
||||
if err := hclsimple.Decode("plugin.json", []byte(data), nil, &cfg); err != nil {
|
||||
if err2 := hclsimple.Decode("plugin.hcl", []byte(data), nil, &cfg); err2 != nil {
|
||||
return cfg, err2
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue