Skip to content

Commit 7155c92

Browse files
Copilottoby
andcommitted
refactor: rename SEED_FILE_PATH to SEED_FROM and remove command line flag
Co-authored-by: toby <83556+toby@users.noreply.github.com>
1 parent ebd50a4 commit 7155c92

File tree

4 files changed

+9
-23
lines changed

4 files changed

+9
-23
lines changed

README.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ The service can be configured using environment variables:
415415
| `MCP_REGISTRY_GITHUB_CLIENT_ID` | GitHub App Client ID | |
416416
| `MCP_REGISTRY_GITHUB_CLIENT_SECRET` | GitHub App Client Secret | |
417417
| `MCP_REGISTRY_LOG_LEVEL` | Log level | `info` |
418-
| `MCP_REGISTRY_SEED_FILE_PATH` | Path or URL to import seed file (supports local files and HTTP URLs) | `data/seed.json` |
418+
| `MCP_REGISTRY_SEED_FROM` | Path or URL to import seed data (supports local files and HTTP URLs) | `data/seed.json` |
419419
| `MCP_REGISTRY_SERVER_ADDRESS` | Listen address for the server | `:8080` |
420420

421421
## Pre-built Docker Images
@@ -442,20 +442,12 @@ Registry instances can import data from:
442442

443443
**Local files:**
444444
```bash
445-
# Via environment variable
446-
MCP_REGISTRY_SEED_FILE_PATH=data/seed.json ./registry
447-
448-
# Via command line flag
449-
./registry --seed-file-path=data/seed.json
445+
MCP_REGISTRY_SEED_FROM=data/seed.json ./registry
450446
```
451447

452448
**HTTP endpoints:**
453449
```bash
454-
# Via environment variable
455-
MCP_REGISTRY_SEED_FILE_PATH=http://other-registry:8080 ./registry
456-
457-
# Via command line flag
458-
./registry --seed-file-path=http://other-registry:8080
450+
MCP_REGISTRY_SEED_FROM=http://other-registry:8080 ./registry
459451
```
460452

461453
## Testing

cmd/registry/main.go

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
func main() {
2323
// Parse command line flags
2424
showVersion := flag.Bool("version", false, "Display version information")
25-
seedFilePath := flag.String("seed-file-path", "", "Path to seed file for importing initial data")
2625
flag.Parse()
2726

2827
// Show version information if requested
@@ -44,11 +43,6 @@ func main() {
4443
// Initialize configuration
4544
cfg := config.NewConfig()
4645

47-
// Override seed file path if provided via command line flag
48-
if *seedFilePath != "" {
49-
cfg.SeedFilePath = *seedFilePath
50-
}
51-
5246
// Initialize services based on environment
5347
switch cfg.DatabaseType {
5448
case config.DatabaseTypeMemory:
@@ -85,14 +79,14 @@ func main() {
8579
return
8680
}
8781

88-
// Import seed data if seed file path is provided (works for both memory and MongoDB)
89-
if cfg.SeedFilePath != "" {
90-
log.Printf("Importing data from %s...", cfg.SeedFilePath)
82+
// Import seed data if seed source is provided (works for both memory and MongoDB)
83+
if cfg.SeedFrom != "" {
84+
log.Printf("Importing data from %s...", cfg.SeedFrom)
9185
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
9286
defer cancel()
9387

94-
if err := db.ImportSeed(ctx, cfg.SeedFilePath); err != nil {
95-
log.Printf("Failed to import seed file: %v", err)
88+
if err := db.ImportSeed(ctx, cfg.SeedFrom); err != nil {
89+
log.Printf("Failed to import seed data: %v", err)
9690
} else {
9791
log.Println("Data import completed successfully")
9892
}

internal/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type Config struct {
1919
DatabaseName string `env:"DATABASE_NAME" envDefault:"mcp-registry"`
2020
CollectionName string `env:"COLLECTION_NAME" envDefault:"servers_v2"`
2121
LogLevel string `env:"LOG_LEVEL" envDefault:"info"`
22-
SeedFilePath string `env:"SEED_FILE_PATH" envDefault:""`
22+
SeedFrom string `env:"SEED_FROM" envDefault:""`
2323
Version string `env:"VERSION" envDefault:"dev"`
2424
GithubClientID string `env:"GITHUB_CLIENT_ID" envDefault:""`
2525
GithubClientSecret string `env:"GITHUB_CLIENT_SECRET" envDefault:""`

registry

28.9 MB
Binary file not shown.

0 commit comments

Comments
 (0)