Skip to content

Commit

Permalink
Get base url from env (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc authored Dec 22, 2023
1 parent 063783f commit f23c19f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ jupyter cad

- A `jupyter-server` endpoint which is ready to compute the mesh upon client demand. This endpoint is defined using [an OpenAPI spec](https://github.com/jupytercad/jupytercad-salome/blob/main/jupytercad_salome/schema/openapi.yaml). Users are not bound to the provided jupyter-server endpoint, `JupyterCAD-Salome` can connect to any server implementing the OpenAPI spec.

> [!NOTE]
> To use `JupyterCAD-Salome` with a different Salome server, set the `SALOME_SERVER_BASE_URL` environment variable to your server address before starting `JupyterLab`.
- A client plugin for JupyterCAD adding UI elements to interact with the mesh-generation endpoint. Whenever the user clicks on the toolbar button, they are prompted with a dialog to configure the API call:

![Meshing configuration](https://github.com/martinRenou/jupytercad-salome/assets/21197331/15b03e37-3716-4f82-b5bf-b99abed6c016)
Expand Down
4 changes: 3 additions & 1 deletion jupytercad_salome/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import os

from jupyter_server.base.handlers import APIHandler
from jupyter_server.utils import url_path_join
Expand All @@ -15,10 +16,11 @@ def get(self):
"""Return the base url of the jupytercad salome server.
Use ``None`` if it is the same JupyterLab server
"""
base_url_env = os.getenv("SALOME_SERVER_BASE_URL", None)
self.finish(
json.dumps(
{
"backend_url": None,
"backend_url": base_url_env,
}
)
)
Expand Down

0 comments on commit f23c19f

Please sign in to comment.