@@ -8,27 +8,80 @@ import (
88 "gopkg.in/yaml.v3"
99)
1010
11+ const (
12+ // RegistrySourceTypeConfigMap is the type for registry data stored in ConfigMaps
13+ SourceTypeConfigMap = "configmap"
14+
15+ // RegistrySourceTypeGit is the type for registry data stored in Git repositories
16+ SourceTypeGit = "git"
17+
18+ // SourceTypeAPI is the type for registry data fetched from API endpoints
19+ SourceTypeAPI = "api"
20+ )
21+
22+ const (
23+ // RegistryFormatToolHive is the native ToolHive registry format
24+ SourceFormatToolHive = "toolhive"
25+
26+ // RegistryFormatUpstream is the upstream MCP registry format
27+ SourceFormatUpstream = "upstream"
28+ )
29+
1130// ConfigLoader defines the interface for loading configuration
1231type ConfigLoader interface {
1332 LoadConfig (path string ) (* Config , error )
1433}
1534
1635// Config represents the root configuration structure
1736type Config struct {
18- Source SourceConfig `yaml:"source"`
19- SyncPolicy SyncPolicyConfig `yaml:"syncPolicy"`
20- Filter FilterConfig `yaml:"filter"`
37+ Source SourceConfig `yaml:"source"`
38+ SyncPolicy * SyncPolicyConfig `yaml:"syncPolicy,omitempty "`
39+ Filter * FilterConfig `yaml:"filter,omitempty "`
2140}
2241
2342// SourceConfig defines the data source configuration
2443type SourceConfig struct {
2544 Type string `yaml:"type"`
45+ Format string `yaml:"format"`
2646 ConfigMap * ConfigMapConfig `yaml:"configmap,omitempty"`
47+ Git * GitConfig `yaml:"git,omitempty"`
48+ API * APIConfig `yaml:"api,omitempty"`
2749}
2850
2951// ConfigMapConfig defines Kubernetes ConfigMap source settings
3052type ConfigMapConfig struct {
31- Name string `yaml:"name"`
53+ Namespace string `yaml:"namespace"`
54+ Name string `yaml:"name"`
55+ Key string `yaml:"key,omitempty"`
56+ }
57+
58+ // GitConfig defines Git source settings
59+ type GitConfig struct {
60+ // Repository is the Git repository URL (HTTP/HTTPS/SSH)
61+ Repository string `yaml:"repository"`
62+
63+ // Branch is the Git branch to use (mutually exclusive with Tag and Commit)
64+ Branch string `yaml:"branch,omitempty"`
65+
66+ // Tag is the Git tag to use (mutually exclusive with Branch and Commit)
67+ Tag string `yaml:"tag,omitempty"`
68+
69+ // Commit is the Git commit SHA to use (mutually exclusive with Branch and Tag)
70+ Commit string `yaml:"commit,omitempty"`
71+
72+ // Path is the path to the registry file within the repository
73+ Path string `yaml:"path,omitempty"`
74+ }
75+
76+ // APIConfig defines API source configuration for ToolHive Registry APIs
77+ type APIConfig struct {
78+ // Endpoint is the base API URL (without path)
79+ // The source handler will append the appropriate paths, for instance:
80+ // - /v0/servers - List all servers (single response, no pagination)
81+ // - /v0/servers/{name} - Get specific server (future)
82+ // - /v0/info - Get registry metadata (future)
83+ // Example: "http://my-registry-api.default.svc.cluster.local/api"
84+ Endpoint string `yaml:"endpoint"`
3285}
3386
3487// SyncPolicyConfig defines synchronization settings
@@ -38,7 +91,14 @@ type SyncPolicyConfig struct {
3891
3992// FilterConfig defines filtering rules for registry entries
4093type FilterConfig struct {
41- Tags TagFilterConfig `yaml:"tags"`
94+ Names * NameFilterConfig `yaml:"names,omitempty"`
95+ Tags * TagFilterConfig `yaml:"tags,omitempty"`
96+ }
97+
98+ // NameFilterConfig defines name-based filtering
99+ type NameFilterConfig struct {
100+ Include []string `yaml:"include,omitempty"`
101+ Exclude []string `yaml:"exclude,omitempty"`
42102}
43103
44104// TagFilterConfig defines tag-based filtering
0 commit comments