@@ -18,41 +18,41 @@ const (
1818 DefaultOIDCScopes = "openid offline_access"
1919)
2020
21- // LLMConfig holds all LLM gateway settings persisted under the llm: key in
21+ // Config holds all LLM gateway settings persisted under the llm: key in
2222// ToolHive's config.yaml.
23- type LLMConfig struct {
24- GatewayURL string `yaml:"gateway_url,omitempty"`
25- OIDC LLMOIDCConfig `yaml:"oidc,omitempty"`
26- Proxy LLMProxyConfig `yaml:"proxy,omitempty"`
27- Auth LLMAuthState `yaml:"auth,omitempty"`
28- ConfiguredTools []LLMToolConfig `yaml:"configured_tools,omitempty"`
23+ type Config struct {
24+ GatewayURL string `yaml:"gateway_url,omitempty"`
25+ OIDC OIDCConfig `yaml:"oidc,omitempty"`
26+ Proxy ProxyConfig `yaml:"proxy,omitempty"`
27+ Auth AuthState `yaml:"auth,omitempty"`
28+ ConfiguredTools []ToolConfig `yaml:"configured_tools,omitempty"`
2929}
3030
31- // LLMOIDCConfig holds OIDC provider settings for the LLM gateway.
32- type LLMOIDCConfig struct {
31+ // OIDCConfig holds OIDC provider settings for the LLM gateway.
32+ type OIDCConfig struct {
3333 Issuer string `yaml:"issuer,omitempty"`
3434 ClientID string `yaml:"client_id,omitempty"`
3535 Scopes []string `yaml:"scopes,omitempty"`
3636 Audience string `yaml:"audience,omitempty"`
3737 CallbackPort int `yaml:"callback_port,omitempty"`
3838}
3939
40- // LLMProxyConfig holds configuration for the localhost reverse proxy.
41- type LLMProxyConfig struct {
40+ // ProxyConfig holds configuration for the localhost reverse proxy.
41+ type ProxyConfig struct {
4242 ListenPort int `yaml:"listen_port,omitempty"`
4343}
4444
45- // LLMAuthState records token lifecycle metadata persisted to config (no token
45+ // AuthState records token lifecycle metadata persisted to config (no token
4646// values — those live in the secrets provider or memory only).
47- type LLMAuthState struct {
47+ type AuthState struct {
4848 // CachedTokenExpiry is the expiry time of the most recently cached access
4949 // token. Used to surface helpful messages when the token is about to expire.
5050 CachedTokenExpiry time.Time `yaml:"cached_token_expiry,omitempty"`
5151}
5252
53- // LLMToolConfig records a tool that setup has configured, so teardown knows
53+ // ToolConfig records a tool that setup has configured, so teardown knows
5454// exactly what to reverse.
55- type LLMToolConfig struct {
55+ type ToolConfig struct {
5656 // Tool is the canonical tool identifier (e.g. "claude-code", "cursor").
5757 Tool string `yaml:"tool"`
5858 // Mode is the authentication mode: "direct" or "proxy".
@@ -63,13 +63,13 @@ type LLMToolConfig struct {
6363
6464// IsConfigured reports whether the minimum required fields are present for the
6565// LLM gateway to be usable: gateway URL, OIDC issuer, and OIDC client ID.
66- func (c * LLMConfig ) IsConfigured () bool {
66+ func (c * Config ) IsConfigured () bool {
6767 return c .GatewayURL != "" && c .OIDC .Issuer != "" && c .OIDC .ClientID != ""
6868}
6969
7070// Validate performs full validation of the LLM config, including HTTPS
7171// enforcement, port range checks, and OIDC field requirements.
72- func (c * LLMConfig ) Validate () error {
72+ func (c * Config ) Validate () error {
7373 var errs []error
7474
7575 if c .GatewayURL == "" {
@@ -99,7 +99,7 @@ func (c *LLMConfig) Validate() error {
9999
100100// EffectiveProxyPort returns the configured proxy listen port, or
101101// DefaultProxyListenPort if none is set.
102- func (c * LLMConfig ) EffectiveProxyPort () int {
102+ func (c * Config ) EffectiveProxyPort () int {
103103 if c .Proxy .ListenPort > 0 {
104104 return c .Proxy .ListenPort
105105 }
@@ -108,7 +108,7 @@ func (c *LLMConfig) EffectiveProxyPort() int {
108108
109109// EffectiveScopes returns the configured OIDC scopes, or the default scopes
110110// (openid, offline_access) if none are set.
111- func (c * LLMOIDCConfig ) EffectiveScopes () []string {
111+ func (c * OIDCConfig ) EffectiveScopes () []string {
112112 if len (c .Scopes ) > 0 {
113113 return c .Scopes
114114 }
0 commit comments