Permalink
Browse files

Remove mongo support

  • Loading branch information...
brycekahle committed Aug 29, 2017
1 parent fb1e3dd commit 4a7a840a8458850d85b75da03524af596f90a412
Showing with 68 additions and 514 deletions.
  1. +0 −12 .travis.yml
  2. +1 −1 README.md
  3. +33 −29 glide.lock
  4. +0 −4 glide.yaml
  5. +3 −3 models/instance.go
  6. +7 −10 models/refresh_token.go
  7. +21 −21 models/user.go
  8. +1 −9 storage/dial/dial.go
  9. +0 −371 storage/mongo/storage.go
  10. +0 −52 storage/mongo/storage_test.go
  11. +2 −2 storage/sql/user.go
@@ -1,21 +1,9 @@
---
language: go
services:
- mongodb
addons:
apt:
sources:
- mongodb-3.2-precise
packages:
- mongodb-org-server
go:
- 1.8
env:
- GOTRUE_MONGODB_TEST_CONN_URL=127.0.0.1
install: make deps
script: make all
@@ -54,7 +54,7 @@ DATABASE_URL=gotrue.db
`DB_DRIVER` - `string` **required**
Chooses what dialect of database you want. Choose from `mongo`, `sqlite3`, `mysql`, or `postgres`.
Chooses what dialect of database you want. Choose from `sqlite3`, `mysql`, or `postgres`.
`DATABASE_URL` (no prefix) / `DB_DATABASE_URL` - `string` **required**

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -14,10 +14,6 @@ import:
- package: gopkg.in/gomail.v2
version: 2.0.0
- package: github.com/netlify/mailme
- package: gopkg.in/mgo.v2
subpackages:
- txn
- bson
- package: github.com/stretchr/testify
version: v1.1.4
subpackages:
@@ -11,12 +11,12 @@ import (
const baseConfigKey = ""
type Instance struct {
ID string `json:"id" bson:"_id,omitempty"`
ID string `json:"id"`
// Netlify UUID
UUID string `json:"uuid,omitempty" bson:"uuid,omitempty"`
UUID string `json:"uuid,omitempty"`
// force usage of text column type
RawBaseConfig string `json:"-" bson:"-" gorm:"size:65535"`
RawBaseConfig string `json:"-" gorm:"size:65535"`
BaseConfig *conf.Configuration `json:"config"`
CreatedAt time.Time `json:"created_at"`
@@ -2,23 +2,20 @@ package models
import (
"time"
"gopkg.in/mgo.v2/bson"
)
// RefreshToken is the database model for refresh tokens.
type RefreshToken struct {
InstanceID string `json:"-" bson:"instance_id"`
ID int64 `bson:"seq_id,omitempty"`
BID bson.ObjectId `bson:"_id" sql:"-"`
InstanceID string `json:"-"`
ID int64
Token string `bson:"token"`
Token string
User User `bson:"-"`
UserID string `bson:"user_id"`
User User
UserID string
Revoked bool `bson:"revoked"`
CreatedAt time.Time `bson:"created_at"`
Revoked bool
CreatedAt time.Time
}
// TableName returns the database table name for RefreshToken
@@ -12,35 +12,35 @@ import (
// User respresents a registered user with email/password authentication
type User struct {
InstanceID string `json:"-" bson:"instance_id"`
ID string `json:"id" bson:"_id,omitempty"`
InstanceID string `json:"-"`
ID string `json:"id"`
Aud string `json:"aud" bson:"aud"`
Role string `json:"role" bson:"role"`
Email string `json:"email" bson:"email"`
EncryptedPassword string `json:"-" bson:"encrypted_password"`
ConfirmedAt *time.Time `json:"confirmed_at" bson:"confirmed_at"`
InvitedAt *time.Time `json:"invited_at" bson:"invited_at"`
Aud string `json:"aud"`
Role string `json:"role"`
Email string `json:"email"`
EncryptedPassword string `json:"-"`
ConfirmedAt *time.Time `json:"confirmed_at"`
InvitedAt *time.Time `json:"invited_at"`
ConfirmationToken string `json:"-" bson:"confirmation_token,omitempty"`
ConfirmationSentAt *time.Time `json:"confirmation_sent_at,omitempty" bson:"confirmation_sent_at,omitempty"`
ConfirmationToken string `json:"-"`
ConfirmationSentAt *time.Time `json:"confirmation_sent_at,omitempty"`
RecoveryToken string `json:"-" bson:"recovery_token,omitempty"`
RecoverySentAt *time.Time `json:"recovery_sent_at,omitempty" bson:"recovery_sent_at,omitempty"`
RecoveryToken string `json:"-"`
RecoverySentAt *time.Time `json:"recovery_sent_at,omitempty"`
EmailChangeToken string `json:"-" bson:"email_change_token,omitempty"`
EmailChange string `json:"new_email,omitempty" bson:"new_email,omitempty"`
EmailChangeSentAt *time.Time `json:"email_change_sent_at,omitempty" bson:"email_change_sent_at,omitempty"`
EmailChangeToken string `json:"-"`
EmailChange string `json:"new_email,omitempty"`
EmailChangeSentAt *time.Time `json:"email_change_sent_at,omitempty"`
LastSignInAt *time.Time `json:"last_sign_in_at,omitempty" bson:"last_sign_in_at,omitempty"`
LastSignInAt *time.Time `json:"last_sign_in_at,omitempty"`
AppMetaData map[string]interface{} `json:"app_metadata,omitempty" sql:"-" bson:"app_metadata,omitempty"`
UserMetaData map[string]interface{} `json:"user_metadata,omitempty" sql:"-" bson:"user_metadata,omitempty"`
AppMetaData map[string]interface{} `json:"app_metadata,omitempty" sql:"-"`
UserMetaData map[string]interface{} `json:"user_metadata,omitempty" sql:"-"`
IsSuperAdmin bool `json:"-" bson:"is_super_admin"`
IsSuperAdmin bool `json:"-"`
CreatedAt time.Time `json:"created_at" bson:"created_at"`
UpdatedAt time.Time `json:"updated_at" bson:"updated_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// NewUser initializes a new user from an email, password and user data.
@@ -4,7 +4,6 @@ import (
"github.com/netlify/gotrue/conf"
"github.com/netlify/gotrue/models"
"github.com/netlify/gotrue/storage"
"github.com/netlify/gotrue/storage/mongo"
"github.com/netlify/gotrue/storage/sql"
)
@@ -14,14 +13,7 @@ func Dial(config *conf.GlobalConfiguration) (storage.Connection, error) {
models.Namespace = config.DB.Namespace
}
var conn storage.Connection
var err error
if config.DB.Driver == "mongo" {
conn, err = mongo.Dial(config)
} else {
conn, err = sql.Dial(config)
}
conn, err := sql.Dial(config)
if err != nil {
return nil, err
}
Oops, something went wrong.

0 comments on commit 4a7a840

Please sign in to comment.