Add an alembic migration for the full initial database with the data. Switch LDAP to using bind and creating a federated login entry. Add LDAP support to the registry and index endpoints. Add a username transliteration and suggestion mechanism. Switch the database and model to require a manual initialization call.
This commit is contained in:
parent
08ccad7fe4
commit
5fdccfe3e6
12 changed files with 739 additions and 75 deletions
|
@ -9,19 +9,19 @@ from playhouse.pool import PooledMySQLDatabase
|
|||
from sqlalchemy.engine.url import make_url
|
||||
from urlparse import urlparse
|
||||
|
||||
from app import app
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
SCHEME_DRIVERS = {
|
||||
'mysql': PooledMySQLDatabase,
|
||||
'mysql+pymysql': PooledMySQLDatabase,
|
||||
'sqlite': SqliteDatabase,
|
||||
}
|
||||
|
||||
db = Proxy()
|
||||
|
||||
def generate_db(config_object):
|
||||
def configure(config_object):
|
||||
db_kwargs = dict(config_object['DB_CONNECTION_ARGS'])
|
||||
parsed_url = make_url(config_object['DB_URI'])
|
||||
|
||||
|
@ -34,10 +34,8 @@ def generate_db(config_object):
|
|||
if parsed_url.password:
|
||||
db_kwargs['passwd'] = parsed_url.password
|
||||
|
||||
return SCHEME_DRIVERS[parsed_url.drivername](parsed_url.database, **db_kwargs)
|
||||
|
||||
|
||||
db = generate_db(app.config)
|
||||
real_db = SCHEME_DRIVERS[parsed_url.drivername](parsed_url.database, **db_kwargs)
|
||||
db.initialize(real_db)
|
||||
|
||||
|
||||
def random_string_generator(length=16):
|
||||
|
|
Reference in a new issue