mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
chore: Remove url and wildcard url from moon create (#7224)
* chore: Remove url and wildcard url from moon create
This commit is contained in:
@ -343,19 +343,27 @@ func WorkspaceProxy(t testing.TB, db database.Store, orig database.WorkspaceProx
|
||||
require.NoError(t, err, "generate secret")
|
||||
hashedSecret := sha256.Sum256([]byte(secret))
|
||||
|
||||
resource, err := db.InsertWorkspaceProxy(context.Background(), database.InsertWorkspaceProxyParams{
|
||||
proxy, err := db.InsertWorkspaceProxy(context.Background(), database.InsertWorkspaceProxyParams{
|
||||
ID: takeFirst(orig.ID, uuid.New()),
|
||||
Name: takeFirst(orig.Name, namesgenerator.GetRandomName(1)),
|
||||
DisplayName: takeFirst(orig.DisplayName, namesgenerator.GetRandomName(1)),
|
||||
Icon: takeFirst(orig.Icon, namesgenerator.GetRandomName(1)),
|
||||
Url: takeFirst(orig.Url, fmt.Sprintf("https://%s.com", namesgenerator.GetRandomName(1))),
|
||||
WildcardHostname: takeFirst(orig.WildcardHostname, fmt.Sprintf("*.%s.com", namesgenerator.GetRandomName(1))),
|
||||
TokenHashedSecret: hashedSecret[:],
|
||||
CreatedAt: takeFirst(orig.CreatedAt, database.Now()),
|
||||
UpdatedAt: takeFirst(orig.UpdatedAt, database.Now()),
|
||||
})
|
||||
require.NoError(t, err, "insert proxy")
|
||||
return resource, secret
|
||||
|
||||
// Also set these fields if the caller wants them.
|
||||
if orig.Url != "" || orig.WildcardHostname != "" {
|
||||
proxy, err = db.RegisterWorkspaceProxy(context.Background(), database.RegisterWorkspaceProxyParams{
|
||||
Url: orig.Url,
|
||||
WildcardHostname: orig.WildcardHostname,
|
||||
ID: proxy.ID,
|
||||
})
|
||||
require.NoError(t, err, "update proxy")
|
||||
}
|
||||
return proxy, secret
|
||||
}
|
||||
|
||||
func File(t testing.TB, db database.Store, orig database.File) database.File {
|
||||
|
Reference in New Issue
Block a user