39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
// Package config provides configuration loading for SPIRE plugins.
|
|
// SPIRE plugins receive configuration via HCL in the SPIRE server/agent config file.
|
|
package config
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
// PluginConfig holds common configuration fields shared by all Guildhouse SPIRE plugins.
|
|
type PluginConfig struct {
|
|
// GovernanceAddr is the gRPC address of the GovernanceService.
|
|
GovernanceAddr string `hcl:"governance_addr"`
|
|
|
|
// CeremonyAddr is the gRPC address of the CeremonyService.
|
|
CeremonyAddr string `hcl:"ceremony_addr"`
|
|
|
|
// NotaryAddr is the gRPC address of the NotaryService.
|
|
NotaryAddr string `hcl:"notary_addr"`
|
|
|
|
// TrustDomain is the SPIFFE trust domain.
|
|
TrustDomain string `hcl:"trust_domain"`
|
|
|
|
// ClusterID identifies this cluster for notary anchoring.
|
|
ClusterID string `hcl:"cluster_id"`
|
|
}
|
|
|
|
// Validate checks that required fields are present.
|
|
func (c *PluginConfig) Validate() error {
|
|
if c.TrustDomain == "" {
|
|
return fmt.Errorf("config: trust_domain is required")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// LoadFromHCL parses plugin configuration from HCL bytes.
|
|
// TODO: implement — use hashicorp/hcl to parse configuration.
|
|
func LoadFromHCL(data []byte) (*PluginConfig, error) {
|
|
return nil, fmt.Errorf("config: LoadFromHCL not yet implemented")
|
|
}
|