Refactor database implementation to use PostgreSQL instead of MongoDB (#289)
Fixes #228 ## Motivation and Context See #19 ## How Has This Been Tested? - Run locally - Run in docker compose - Run infra in minikube - Unit and integration tests all passing :) ## Breaking Changes Yes: users will not be able to access any data they used to have in custom mongodb. We are accepting this breaking change, given the registry is in experimental development status. ## 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) - [ ] New feature (non-breaking change which adds functionality) - [x] 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 ## Additional context I have not implemented connection pooling support for simplicity, and because cloudnative-pg already provides built-in connection pooling with pgBouncer so if we want it later we can switch to this endpoint easily.
This commit is contained in:
parent
ee910ca286
commit
ebaf4c9c99
1 changed files with 846 additions and 564 deletions
|
|
@ -7,16 +7,16 @@ import (
|
|||
type DatabaseType string
|
||||
|
||||
const (
|
||||
DatabaseTypeMongoDB DatabaseType = "mongodb"
|
||||
DatabaseTypeMemory DatabaseType = "memory"
|
||||
DatabaseTypePostgreSQL DatabaseType = "postgresql"
|
||||
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"`
|
||||
DatabaseType DatabaseType `env:"DATABASE_TYPE" envDefault:"postgresql"`
|
||||
DatabaseURL string `env:"DATABASE_URL" envDefault:"postgres://localhost:5432/mcp-registry?sslmode=disable"`
|
||||
DatabaseName string `env:"DATABASE_NAME" envDefault:"mcp-registry"`
|
||||
CollectionName string `env:"COLLECTION_NAME" envDefault:"servers_v2"`
|
||||
LogLevel string `env:"LOG_LEVEL" envDefault:"info"`
|
||||
|
|
|
|||
Loading…
Reference in a new issue