config

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthValue

type AuthValue struct {
	Header string `mapstructure:"header"`
	Prefix string `mapstructure:"prefix"`
	Value  string `mapstructure:"value"`
}

type Config

type Config struct {
	Gateway   Gateway `mapstructure:"gateway"`
	MCPServer Servers `mapstructure:"mcpServers"`

	Redis  *RedisConfig  `mapstructure:"redis"`
	SQLite *SQLiteConfig `mapstructure:"sqlite"`

	Telemetry telemetry.Config `mapstructure:"telemetry"`
}

func Load

func Load(ctx context.Context) (*Config, error)

Load reads the configuration from the config.yaml file and environment variables.

func (*Config) ValidateWithContext added in v1.2.0

func (c *Config) ValidateWithContext(ctx context.Context) error

type Gateway

type Gateway struct {
	Port int `mapstructure:"port"`

	Key  string `mapstructure:"key"`
	Cert string `mapstructure:"cert"`

	EncryptKey string `mapstructure:"encryptKey"`
}

func (Gateway) ValidateWithContext added in v1.2.0

func (c Gateway) ValidateWithContext(ctx context.Context) error

type MCPTransport

type MCPTransport string
const (
	MCPTransportHTTP  MCPTransport = "http"
	MCPTransportStdio MCPTransport = "stdio"
)

type OAuth2

type OAuth2 struct {
	ClientID     string   `mapstructure:"clientID"`
	ClientSecret string   `mapstructure:"clientSecret"`
	AuthURL      string   `mapstructure:"authURL"`
	TokenURL     string   `mapstructure:"tokenURL"`
	Scopes       []string `mapstructure:"scopes"`
}

type RedisConfig

type RedisConfig struct {
	URL         string   `mapstructure:"url"`
	Addrs       []string `mapstructure:"addrs"`
	User        string   `mapstructure:"user"`
	Password    string   `mapstructure:"password"`
	DB          int      `mapstructure:"db"`
	MasterName  string   `mapstructure:"master_name"`
	TLS         bool     `mapstructure:"tls"`
	ClusterMode bool     `mapstructure:"cluster_mode"`
}

type SQLiteConfig added in v1.1.0

type SQLiteConfig struct {
	// Path はSQLiteデータベースファイルのパス。
	// ":memory:" を指定するとインメモリDBとして動作する。
	Path string `mapstructure:"path"`
}

SQLiteConfig はSQLiteストレージの設定。

type Server

type Server struct {
	Name         string
	Description  string            `mapstructure:"description"`
	BaseURL      string            `mapstructure:"baseURL"`
	Spec         string            `mapstructure:"spec"` // ファイル or http(s)(OpenAPI モード)
	ExtraHeaders map[string]string `mapstructure:"headers"`
	AuthValue    *AuthValue        `mapstructure:"authValue"`
	OAuth2       *OAuth2           `mapstructure:"oauth2"`

	// MCP バックエンドモード用(Spec が空のとき有効)
	Transport MCPTransport      `mapstructure:"transport"`
	URL       string            `mapstructure:"url"`     // streamable_http 用
	Command   string            `mapstructure:"command"` // stdio 用
	Args      []string          `mapstructure:"args"`
	Env       map[string]string `mapstructure:"env"`
}

func (*Server) IsMCPBackend

func (s *Server) IsMCPBackend() bool

IsMCPBackend はこの Server が MCP バックエンドモードかどうかを返す。 Spec が空で Transport が指定されている場合に MCP バックエンドモードとなる。

func (Server) ValidateWithContext added in v1.2.0

func (s Server) ValidateWithContext(ctx context.Context) error

type Servers

type Servers map[string]*Server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL