Remove LIVEBOOK_APPS_PATH_HUB_ID in favour of LIVEBOOK_TEAMS_AUTH (#2829)

This commit is contained in:
Jonatan Kłosko 2024-10-15 10:49:48 +02:00 committed by GitHub
parent 049888cb25
commit e487c56d1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 17 additions and 16 deletions

View file

@ -177,9 +177,6 @@ The following environment variables can be used to configure Livebook on boot:
is set. When deploying using Livebook's Docker image, consider using
`LIVEBOOK_APPS_PATH_WARMUP`.
* `LIVEBOOK_APPS_PATH_HUB_ID` - deploy only the notebooks in
`LIVEBOOK_APPS_PATH` that belong to the given workspace (known as HUB ID)
* `LIVEBOOK_APPS_PATH_PASSWORD` - the password to use for all protected apps
deployed from `LIVEBOOK_APPS_PATH`.

View file

@ -182,8 +182,12 @@ defmodule Livebook do
config :livebook, :apps_path, apps_path
end
if apps_path_hub_id = System.get_env("LIVEBOOK_APPS_PATH_HUB_ID") do
config :livebook, :apps_path_hub_id, apps_path_hub_id
# TODO: remove in v1.0
if System.get_env("LIVEBOOK_APPS_PATH_HUB_ID") do
IO.warn(
~s/Ignoring LIVEBOOK_APPS_PATH_HUB_ID, this environment variable is no longer used./,
[]
)
end
if apps_path_password = Livebook.Config.password!("LIVEBOOK_APPS_PATH_PASSWORD") do

View file

@ -231,16 +231,19 @@ defmodule Livebook.Application do
teams_key && auth ->
Application.put_env(:livebook, :teams_auth?, true)
case String.split(auth, ":") do
["offline", name, public_key] ->
create_offline_hub(teams_key, name, public_key)
hub =
case String.split(auth, ":") do
["offline", name, public_key] ->
create_offline_hub(teams_key, name, public_key)
["online", name, org_id, org_key_id, agent_key] ->
create_online_hub(teams_key, name, org_id, org_key_id, agent_key)
["online", name, org_id, org_key_id, agent_key] ->
create_online_hub(teams_key, name, org_id, org_key_id, agent_key)
_ ->
Livebook.Config.abort!("Invalid LIVEBOOK_TEAMS_AUTH configuration.")
end
_ ->
Livebook.Config.abort!("Invalid LIVEBOOK_TEAMS_AUTH configuration.")
end
Application.put_env(:livebook, :apps_path_hub_id, hub.id)
teams_key || auth ->
Livebook.Config.abort!(

View file

@ -100,7 +100,6 @@ defmodule Livebook.Hubs.Dockerfile do
# Apps configuration
ENV LIVEBOOK_APPS_PATH "/apps"
ENV LIVEBOOK_APPS_PATH_WARMUP "manual"
ENV LIVEBOOK_APPS_PATH_HUB_ID "#{hub.id}"
"""
notebook =

View file

@ -25,7 +25,6 @@ defmodule Livebook.Hubs.DockerfileTest do
# Apps configuration
ENV LIVEBOOK_APPS_PATH "/apps"
ENV LIVEBOOK_APPS_PATH_WARMUP "manual"
ENV LIVEBOOK_APPS_PATH_HUB_ID "personal-hub"
# Notebook
COPY notebook.livemd /apps/
@ -108,7 +107,6 @@ defmodule Livebook.Hubs.DockerfileTest do
# Apps configuration
ENV LIVEBOOK_APPS_PATH "/apps"
ENV LIVEBOOK_APPS_PATH_WARMUP "manual"
ENV LIVEBOOK_APPS_PATH_HUB_ID "team-org-name-387"
# Notebook
COPY notebook.livemd /apps/