Skip to content

Commit

Permalink
chore(dev): Set default port to 4200 in backend configuration
Browse files Browse the repository at this point in the history
This removed some separate handling with the DEVELOPMENT_MODE
variable. Also, the internal session viewer can be used out of the box.
  • Loading branch information
MoritzWeber0 committed Oct 16, 2024
1 parent e7577f5 commit 2dfe91f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 19 deletions.
10 changes: 3 additions & 7 deletions backend/capellacollab/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import capellacollab.projects.toolmodels.backups.runs.interface as pipeline_runs_interface
import capellacollab.sessions.metrics as sessions_metrics
import capellacollab.settings.modelsources.t4c.license_server.metrics as t4c_metrics
from capellacollab import core

# This import statement is required and should not be removed! (Alembic will not work otherwise)
from capellacollab.config import config
Expand All @@ -42,12 +41,9 @@
handlers=[stream_handler, timed_rotating_file_handler],
)

ALLOW_ORIGINS = (
[f"{config.general.scheme}//{config.general.host}:{config.general.port}"]
+ ["http://localhost:4200", "http://127.0.0.1:4200"]
if core.DEVELOPMENT_MODE
else []
)
ALLOW_ORIGINS = [
f"{config.general.scheme}://{config.general.host}:{config.general.port}"
]


async def startup():
Expand Down
2 changes: 1 addition & 1 deletion backend/capellacollab/config/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class GeneralConfig(BaseConfig):
examples=["localhost", "capella.example.com"],
)
port: int | str = pydantic.Field(
default=8000,
default=4200,
description="The port the application should run on.",
examples=[8000, 443, 8080],
)
Expand Down
13 changes: 2 additions & 11 deletions backend/capellacollab/core/database/migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from alembic import migration
from sqlalchemy import orm

from capellacollab import core
from capellacollab.config import config
from capellacollab.core import database
from capellacollab.events import crud as events_crud
Expand Down Expand Up @@ -156,11 +155,7 @@ def get_eclipse_session_configuration() -> (
environment={
"CONNECTION_METHOD": "xpra",
"XPRA_SUBPATH": "{CAPELLACOLLAB_SESSIONS_BASE_PATH}",
"XPRA_CSP_ORIGIN_HOST": (
"http://localhost:4200"
if core.DEVELOPMENT_MODE
else "{CAPELLACOLLAB_ORIGIN_BASE_URL}"
),
"XPRA_CSP_ORIGIN_HOST": "{CAPELLACOLLAB_ORIGIN_BASE_URL}",
},
redirect_url="{CAPELLACOLLAB_SESSIONS_SCHEME}://{CAPELLACOLLAB_SESSIONS_HOST}:{CAPELLACOLLAB_SESSIONS_PORT}{CAPELLACOLLAB_SESSIONS_BASE_PATH}/?floating_menu=0&sharing=1&path={CAPELLACOLLAB_SESSIONS_BASE_PATH}/",
cookies={
Expand Down Expand Up @@ -277,11 +272,7 @@ def create_jupyter_tool(db: orm.Session) -> tools_models.DatabaseTool:
environment={
"JUPYTER_PORT": "8888",
"JUPYTER_TOKEN": "{CAPELLACOLLAB_SESSION_TOKEN}",
"CSP_ORIGIN_HOST": (
"http://localhost:4200"
if core.DEVELOPMENT_MODE
else "{CAPELLACOLLAB_ORIGIN_BASE_URL}"
),
"CSP_ORIGIN_HOST": "{CAPELLACOLLAB_ORIGIN_BASE_URL}",
"JUPYTER_BASE_URL": "{CAPELLACOLLAB_SESSIONS_BASE_PATH}",
},
connection=tools_models.ToolSessionConnection(
Expand Down

0 comments on commit 2dfe91f

Please sign in to comment.