Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions tljh-plasma/tljh_plasma/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from tljh_repo2docker import TLJH_R2D_ADMIN_SCOPE, SpawnerMixin
from traitlets import Unicode

DB_URL = "sqlite:///tljh_plasma.sqlite"
TLJH_PLASMA_DB_URL = os.environ.get("TLJH_PLASMA_DB_URL", "sqlite:///tljh_plasma.sqlite")
Base = declarative_base()


Expand All @@ -28,7 +28,7 @@ class Permissions(Base):
image = Column(SAUnicode(255))


engine = create_engine(DB_URL)
engine = create_engine(TLJH_PLASMA_DB_URL)
Session = sessionmaker(bind=engine)
Base.metadata.create_all(engine)

Expand Down Expand Up @@ -154,6 +154,9 @@ def tljh_custom_jupyterhub_config(c):
"--port",
"6788",
],
"environment": {
"TLJH_PLASMA_DB_URL": TLJH_PLASMA_DB_URL,
},
"oauth_no_confirm": True,
"oauth_client_allowed_scopes": [
TLJH_R2D_ADMIN_SCOPE,
Expand Down
8 changes: 6 additions & 2 deletions tljh-plasma/tljh_plasma/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from traitlets import Dict, Int, List, Set, Unicode, default, validate
from traitlets.config.application import Application

from . import DB_URL
from . import TLJH_PLASMA_DB_URL
from .permissions import PermissionsAPIHandler, PermissionsHandler

if os.environ.get("JUPYTERHUB_API_TOKEN"):
Expand Down Expand Up @@ -123,8 +123,12 @@ def _include_groups_default(self):
include_list = tljh_config.get("plasma", {}).get("groups", [])
return set(include_list)

@default("db_url")
def _db_url_default(self):
return os.environ.get("TLJH_PLASMA_DB_URL", "sqlite:///tljh_plasma.sqlite")

db_url = Unicode(
DB_URL,
"",
help="url for the database.",
config=True,
)
Expand Down