-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: split assets settings in server and non-server parts
Based on: * #479 * #480 * #486 We decided that using the proxy and the cdn if the proxy is not used is not only something to be used in solara server. In vscode or colab, we cannot use the proxy, and need to use the cdn directly.
- Loading branch information
1 parent
e16916e
commit da06303
Showing
6 changed files
with
24 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,8 +74,6 @@ class Config: | |
|
||
|
||
class Assets(BaseSettings): | ||
cdn: str = "https://cdn.jsdelivr.net/npm/" | ||
proxy: bool = True | ||
proxy_cache_dir: Path = Path(prefix + "/share/solara/cdn/") | ||
fontawesome_enabled: bool = True | ||
fontawesome_path: str = "/[email protected]/css/font-awesome.min.css" | ||
|
@@ -171,14 +169,15 @@ class Config: | |
# fail early | ||
solara.util.parse_timedelta(kernel.cull_timeout) | ||
|
||
if assets.proxy: | ||
if settings.assets.proxy: | ||
try: | ||
assets.proxy_cache_dir.mkdir(exist_ok=True, parents=True) | ||
except OSError as e: | ||
assets.proxy = False | ||
settings.assets.proxy = False | ||
warnings.warn( | ||
f"Could not create {assets.proxy_cache_dir} due to {e}. We will automatically disable the assets proxy for you. " | ||
"If you want to disable this warning, set SOLARA_ASSETS_PROXY to False (e.g. export SOLARA_ASSETS_PROXY=false)." | ||
"If you want to disable this warning, set SOLARA_ASSETS_PROXY to False (e.g. export SOLARA_ASSETS_PROXY=false). " | ||
"Or change the SOLARA_PROXY_CACHE_DIR environment variable to a directory where you have write access." | ||
) | ||
# that's ok, the user probably doesn't have permission to create the directory | ||
# in this case, we would need to install solara-assets? | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters