## Motivation and Context - Adds credentials for the new MCP Registry Login GitHub Apps (local, staging, prod) - Adds support for "none" auth to publisher ## How Has This Been Tested? - Tested publisher workflows locally - Unit and integration tests passing ## Breaking Changes None ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] My code follows the repository's style guidelines - [x] New and existing tests pass locally - [x] I have added appropriate error handling - [x] I have added or updated documentation as needed --- Merging based on Tadas's approval review, and only making minor docs changes on top of that.
41 lines
1.4 KiB
Go
41 lines
1.4 KiB
Go
package config
|
|
|
|
import (
|
|
env "github.com/caarlos0/env/v11"
|
|
)
|
|
|
|
type DatabaseType string
|
|
|
|
const (
|
|
DatabaseTypeMongoDB DatabaseType = "mongodb"
|
|
DatabaseTypeMemory DatabaseType = "memory"
|
|
)
|
|
|
|
// Config holds the application configuration
|
|
// See .env.example for more documentation
|
|
type Config struct {
|
|
ServerAddress string `env:"SERVER_ADDRESS" envDefault:":8080"`
|
|
DatabaseType DatabaseType `env:"DATABASE_TYPE" envDefault:"mongodb"`
|
|
DatabaseURL string `env:"DATABASE_URL" envDefault:"mongodb://localhost:27017"`
|
|
DatabaseName string `env:"DATABASE_NAME" envDefault:"mcp-registry"`
|
|
CollectionName string `env:"COLLECTION_NAME" envDefault:"servers_v2"`
|
|
LogLevel string `env:"LOG_LEVEL" envDefault:"info"`
|
|
SeedFrom string `env:"SEED_FROM" envDefault:""`
|
|
Version string `env:"VERSION" envDefault:"dev"`
|
|
GithubClientID string `env:"GITHUB_CLIENT_ID" envDefault:""`
|
|
GithubClientSecret string `env:"GITHUB_CLIENT_SECRET" envDefault:""`
|
|
JWTPrivateKey string `env:"JWT_PRIVATE_KEY" envDefault:""`
|
|
EnableAnonymousAuth bool `env:"ENABLE_ANONYMOUS_AUTH" envDefault:"false"`
|
|
}
|
|
|
|
// NewConfig creates a new configuration with default values
|
|
func NewConfig() *Config {
|
|
var cfg Config
|
|
err := env.ParseWithOptions(&cfg, env.Options{
|
|
Prefix: "MCP_REGISTRY_",
|
|
})
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return &cfg
|
|
}
|