Skip to content

Commit a3d167e

Browse files
feat: update creation of manifest
1 parent 39b0e41 commit a3d167e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

coderd/agentapi/manifest.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func (a *ManifestAPI) GetManifest(ctx context.Context, _ *agentproto.GetManifest
4848
metadata []database.WorkspaceAgentMetadatum
4949
workspace database.Workspace
5050
devcontainers []database.WorkspaceAgentDevcontainer
51+
userSecrets []database.UserSecret
5152
)
5253

5354
var eg errgroup.Group
@@ -84,6 +85,13 @@ func (a *ManifestAPI) GetManifest(ctx context.Context, _ *agentproto.GetManifest
8485
}
8586
return nil
8687
})
88+
eg.Go(func() (err error) {
89+
userSecrets, err = a.Database.ListUserSecrets(ctx, workspace.OwnerID)
90+
if err != nil && !xerrors.Is(err, sql.ErrNoRows) {
91+
return err
92+
}
93+
return nil
94+
})
8795
err = eg.Wait()
8896
if err != nil {
8997
return nil, xerrors.Errorf("fetching workspace agent data: %w", err)
@@ -140,9 +148,24 @@ func (a *ManifestAPI) GetManifest(ctx context.Context, _ *agentproto.GetManifest
140148
Apps: apps,
141149
Metadata: dbAgentMetadataToProtoDescription(metadata),
142150
Devcontainers: dbAgentDevcontainersToProto(devcontainers),
151+
152+
UserSecrets: dbUserSecretsToProto(userSecrets),
143153
}, nil
144154
}
145155

156+
func dbUserSecretsToProto(userSecrets []database.UserSecret) map[string]*agentproto.Secret {
157+
userSecretsProto := make(map[string]*agentproto.Secret)
158+
for _, userSecret := range userSecrets {
159+
userSecretsProto[userSecret.Name] = &agentproto.Secret{
160+
Name: userSecret.Name,
161+
EnvName: userSecret.EnvName,
162+
FilePath: userSecret.FilePath,
163+
}
164+
}
165+
166+
return userSecretsProto
167+
}
168+
146169
func vscodeProxyURI(app appurl.ApplicationURL, accessURL *url.URL, appHost string) string {
147170
// Proxying by port only works for subdomains. If subdomain support is not
148171
// available, return an empty string.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy