- Added authentication service and GitHub OAuth integration. - Introduced new authentication methods and structures in the model. - Updated the API to handle authentication during the publishing process. - Created handlers for starting and checking the status of the OAuth flow. - Enhanced the publish handler to validate authentication credentials. - Updated configuration to include GitHub OAuth settings. - Added tests for the OAuth flow and publishing with authentication. - Updated documentation to reflect changes in the API and authentication process.
33 lines
1.1 KiB
Go
33 lines
1.1 KiB
Go
package config
|
|
|
|
import (
|
|
"github.com/caarlos0/env/v11"
|
|
)
|
|
|
|
// Config holds the application configuration
|
|
type Config struct {
|
|
ServerAddress string `env:"SERVER_ADDRESS" envDefault:":8080"`
|
|
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"`
|
|
Environment string `env:"ENVIRONMENT" envDefault:"production"`
|
|
Version string `env:"VERSION" envDefault:"dev"`
|
|
|
|
// GitHub OAuth settings
|
|
GithubClientID string `env:"GITHUB_CLIENT_ID" envDefault:""`
|
|
GithubClientSecret string `env:"GITHUB_CLIENT_SECRET" envDefault:""`
|
|
RequireAuth bool `env:"REQUIRE_AUTH" envDefault:"false"` // Whether to require authentication for publishing
|
|
}
|
|
|
|
// 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
|
|
}
|