37 lines
707 B
Markdown
37 lines
707 B
Markdown
|
|
# Exemple minimal
|
||
|
|
|
||
|
|
```go
|
||
|
|
type Profile struct {
|
||
|
|
BaseURL string `json:"base_url"`
|
||
|
|
}
|
||
|
|
|
||
|
|
func run(ctx context.Context, flagProfile string) error {
|
||
|
|
cfgStore := config.NewStore[Profile]("my-mcp")
|
||
|
|
|
||
|
|
cfg, _, err := cfgStore.LoadDefault()
|
||
|
|
if err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
profileName := cli.ResolveProfileName(flagProfile, os.Getenv("MY_MCP_PROFILE"), cfg.CurrentProfile)
|
||
|
|
profile := cfg.Profiles[profileName]
|
||
|
|
|
||
|
|
manifestFile, _, err := manifest.LoadDefault(".")
|
||
|
|
if err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
err = update.Run(ctx, update.Options{
|
||
|
|
CurrentVersion: version,
|
||
|
|
BinaryName: "my-mcp",
|
||
|
|
ReleaseSource: manifestFile.Update.ReleaseSource(),
|
||
|
|
})
|
||
|
|
if err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
_ = profile
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
```
|