Skip to content
Merged
Prev Previous commit
Merge branch 'main' into oauth
  • Loading branch information
kylecarbs committed Apr 23, 2022
commit aa9e5b7541a0c885ab2f03266da33432bbcd7bdf
20 changes: 12 additions & 8 deletions coderd/coderd.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,18 @@ type Options struct {
Pubsub database.Pubsub

AgentConnectionUpdateFrequency time.Duration
AWSCertificates awsidentity.Certificates
AzureCertificates x509.VerifyOptions
GoogleTokenValidator *idtoken.Validator
GithubOAuth2Config *GithubOAuth2Config
ICEServers []webrtc.ICEServer
SecureAuthCookie bool
SSHKeygenAlgorithm gitsshkey.Algorithm
TURNServer *turnconn.Server
// APIRateLimit is the minutely throughput rate limit per user or ip.
// Setting a rate limit <0 will disable the rate limiter across the entire
// app. Specific routes may have their own limiters.
APIRateLimit int
AWSCertificates awsidentity.Certificates
AzureCertificates x509.VerifyOptions
GoogleTokenValidator *idtoken.Validator
GithubOAuth2Config *GithubOAuth2Config
ICEServers []webrtc.ICEServer
SecureAuthCookie bool
SSHKeygenAlgorithm gitsshkey.Algorithm
TURNServer *turnconn.Server
}

// New constructs the Coder API into an HTTP handler.
Expand Down
28 changes: 18 additions & 10 deletions coderd/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -832,16 +832,6 @@ func generateAPIKeyIDSecret() (id string, secret string, err error) {
return id, secret, nil
}

func convertUser(user database.User) codersdk.User {
return codersdk.User{
ID: user.ID,
Email: user.Email,
CreatedAt: user.CreatedAt,
Username: user.Username,
Name: user.Name,
}
}

func (api *api) createAPIKey(rw http.ResponseWriter, r *http.Request, params database.InsertAPIKeyParams) (string, bool) {
keyID, keySecret, err := generateAPIKeyIDSecret()
if err != nil {
Expand Down Expand Up @@ -952,3 +942,21 @@ func (api *api) createUser(ctx context.Context, req codersdk.CreateUserRequest)
return nil
})
}

func convertUser(user database.User) codersdk.User {
return codersdk.User{
ID: user.ID,
Email: user.Email,
CreatedAt: user.CreatedAt,
Username: user.Username,
Name: user.Name,
}
}

func convertUsers(users []database.User) []codersdk.User {
converted := make([]codersdk.User, 0, len(users))
for _, u := range users {
converted = append(converted, convertUser(u))
}
return converted
}
2 changes: 1 addition & 1 deletion site/src/api/typesGenerated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export interface CreateWorkspaceRequest {
readonly name: string
}

// From codersdk/users.go:81:6.
// From codersdk/users.go:96:6.
export interface AuthMethods {
readonly password: boolean
readonly github: boolean
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.