feat: share env files in --demo
Providers whose containers are files give their contents through provider.Contents, which sharing reads instead of the disk. The demo repos build their env files from their keys, and the second demo account has a key to share with (kv-shared-prod / env-share), so S → f and opening the link work in --demo; the demo repos aren't on disk, so opening asks where to save. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
7 files changed
+86
-9
No files matched your search
@@ -134,3 +134,18 @@ func format(path string) string {
|
||||
}
|
||||
return "dotenv"
|
||||
}
|
||||
|
||||
var _ provider.Contents = (*Provider)(nil)
|
||||
|
||||
// Contents is a plain env file as KEY=value lines, from its keys, so the
|
||||
// demo repos' env files can be shared.
|
||||
func (p *Provider) Contents(ctx context.Context, c provider.Container) ([]byte, error) {
|
||||
if c.Detail != provider.DetailPlainEnv {
|
||||
return nil, provider.ErrUnsupported
|
||||
}
|
||||
var b strings.Builder
|
||||
for _, o := range p.objects[listKey{c.ID, provider.TypeSecret}] {
|
||||
b.WriteString(o.Name + "=" + p.values[o.ID] + "\n")
|
||||
}
|
||||
return []byte(b.String()), ctx.Err()
|
||||
}
|
||||
Reference in new issue
Block a user