Skip to content

Commit

Permalink
load CNAME'd tenants first (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
goenning authored Aug 31, 2017
1 parent 183399b commit 9fc90a0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/storage/postgres/tenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (s *TenantStorage) First() (*models.Tenant, error) {
func (s *TenantStorage) GetByDomain(domain string) (*models.Tenant, error) {
tenant := dbTenant{}

err := s.trx.Get(&tenant, "SELECT id, name, subdomain, cname, invitation, welcome_message FROM tenants WHERE subdomain = $1 OR cname = $2", extractSubdomain(domain), domain)
err := s.trx.Get(&tenant, "SELECT id, name, subdomain, cname, invitation, welcome_message FROM tenants WHERE subdomain = $1 OR cname = $2 ORDER BY cname DESC", extractSubdomain(domain), domain)
if err == sql.ErrNoRows {
return nil, app.ErrNotFound
} else if err != nil {
Expand Down

0 comments on commit 9fc90a0

Please sign in to comment.