Init world. Basic registry API server
Work in progress . This commit adds the core registry service implementation with methods to: - Retrieve all registry entries - List entries with cursor-based pagination - Fetch specific server details by ID
This commit is contained in:
parent
2e8c761edf
commit
4fb5bc477e
1 changed files with 1702 additions and 2 deletions
56
internal/config/config.go
Normal file
56
internal/config/config.go
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
package config
|
||||
|
||||
import "os"
|
||||
|
||||
// Config holds the application configuration
|
||||
type Config struct {
|
||||
ServerAddress string
|
||||
DatabaseURL string
|
||||
DatabaseName string
|
||||
CollectionName string
|
||||
LogLevel string
|
||||
Environment string // Added environment field
|
||||
Version string // Application version
|
||||
}
|
||||
|
||||
// NewConfig creates a new configuration with default values
|
||||
func NewConfig() *Config {
|
||||
// Get environment from OS environment variable or default to "production"
|
||||
env := os.Getenv("APP_ENV")
|
||||
if env == "" {
|
||||
env = "production"
|
||||
}
|
||||
|
||||
// Get version from environment variable or default to "dev"
|
||||
version := os.Getenv("APP_VERSION")
|
||||
if version == "" {
|
||||
version = "dev"
|
||||
}
|
||||
|
||||
// Get database URL from environment variable or default to localhost
|
||||
dbURL := os.Getenv("DATABASE_URL")
|
||||
if dbURL == "" {
|
||||
dbURL = "localhost:5432"
|
||||
}
|
||||
|
||||
// Get database name from environment variable or default to "mcp_registry"
|
||||
dbName := os.Getenv("DATABASE_NAME")
|
||||
if dbName == "" {
|
||||
dbName = "mcp-registry"
|
||||
}
|
||||
// Get collection name from environment variable or default to "entries"
|
||||
collectionName := os.Getenv("COLLECTION_NAME")
|
||||
if collectionName == "" {
|
||||
collectionName = "servers_v2"
|
||||
}
|
||||
|
||||
return &Config{
|
||||
ServerAddress: ":8080",
|
||||
DatabaseURL: dbURL,
|
||||
DatabaseName: dbName,
|
||||
CollectionName: collectionName,
|
||||
LogLevel: "info",
|
||||
Environment: env,
|
||||
Version: version,
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue