From 8041d8ee9a2b2485dbdeb888a6e04f3f3ad1a824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 3 Aug 2023 21:36:47 +0200 Subject: [PATCH] Remove create hub feature flag, warn if using production servers in dev --- config/dev.exs | 9 +++--- config/test.exs | 13 +++----- lib/livebook.ex | 2 +- lib/livebook/config.ex | 7 +++++ lib/livebook/teams/org.ex | 2 +- lib/livebook_web/live/hub/new_live.ex | 43 ++++----------------------- 6 files changed, 22 insertions(+), 54 deletions(-) diff --git a/config/dev.exs b/config/dev.exs index 0bc8d6b4f..1d2b7071b 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -16,11 +16,10 @@ config :livebook, LivebookWeb.Endpoint, npm: ["run", "watch", cd: Path.expand("../assets", __DIR__)] ] -config :livebook, :iframe_port, 4001 -config :livebook, :shutdown_callback, {System, :stop, []} - -# Feature flags -config :livebook, :feature_flags, create_hub: true +config :livebook, + iframe_port: 4001, + shutdown_callback: {System, :stop, []}, + warn_on_live_teams_server: true # ## SSL Support # diff --git a/config/test.exs b/config/test.exs index 40a26205f..45d204f2b 100644 --- a/config/test.exs +++ b/config/test.exs @@ -6,13 +6,14 @@ config :livebook, LivebookWeb.Endpoint, http: [port: 4002], server: false -config :livebook, :iframe_port, 4003 - # Print only warnings and errors during test config :logger, level: :warning # Disable authentication mode during test -config :livebook, :authentication_mode, :disabled +config :livebook, + authentication_mode: :disabled, + check_completion_data_interval: 300, + iframe_port: 4003 data_path = Path.expand("tmp/livebook_data/test") @@ -23,14 +24,8 @@ end config :livebook, :data_path, data_path -# Feature flags -config :livebook, :feature_flags, create_hub: true - # Use longnames when running tests in CI, so that no host resolution is required, # see https://github.com/livebook-dev/livebook/pull/173#issuecomment-819468549 if System.get_env("CI") == "true" do config :livebook, :node, {:longnames, :"livebook@127.0.0.1"} end - -# Teams -config :livebook, check_completion_data_interval: 300 diff --git a/lib/livebook.ex b/lib/livebook.ex index 9dd0d08d1..bd63880e2 100644 --- a/lib/livebook.ex +++ b/lib/livebook.ex @@ -126,7 +126,7 @@ defmodule Livebook do end if url = Livebook.Config.teams_url!("LIVEBOOK_TEAMS_URL") do - config :livebook, :teams_url, url + config :livebook, teams_url: url, warn_on_live_teams_server: false end if Livebook.Config.boolean!("LIVEBOOK_SHUTDOWN_ENABLED", false) do diff --git a/lib/livebook/config.ex b/lib/livebook/config.ex index 2da2b32f3..c9e46c335 100644 --- a/lib/livebook/config.ex +++ b/lib/livebook/config.ex @@ -312,6 +312,13 @@ defmodule Livebook.Config do Application.fetch_env!(:livebook, :random_boot_id) end + @doc """ + If we should warn when using production servers. + """ + def warn_on_live_teams_server?() do + Application.get_env(:livebook, :warn_on_live_teams_server, false) + end + ## Parsing @doc """ diff --git a/lib/livebook/teams/org.ex b/lib/livebook/teams/org.ex index ef258aa3a..27895eea3 100644 --- a/lib/livebook/teams/org.ex +++ b/lib/livebook/teams/org.ex @@ -49,7 +49,7 @@ defmodule Livebook.Teams.Org do |> cast(attrs, @fields) |> validate_required(@required_fields) |> validate_format(:name, ~r/^[a-z0-9][a-z0-9\-]*$/, - message: "should only contain alphanumeric characters and dashes" + message: "should only contain lowercase alphanumeric characters and dashes" ) end diff --git a/lib/livebook_web/live/hub/new_live.ex b/lib/livebook_web/live/hub/new_live.ex index cd6459169..971d06f6e 100644 --- a/lib/livebook_web/live/hub/new_live.ex +++ b/lib/livebook_web/live/hub/new_live.ex @@ -15,13 +15,10 @@ defmodule LivebookWeb.Hub.NewLive do @impl true def mount(_params, _session, socket) do - enabled? = Livebook.Config.feature_flag_enabled?(:create_hub) - socket = assign(socket, selected_option: "new-org", page_title: "Hub - Livebook", - enabled?: enabled?, requested_code: false, org: nil, verification_uri: nil, @@ -36,44 +33,14 @@ defmodule LivebookWeb.Hub.NewLive do end @impl true - def render(%{enabled?: false} = assigns) do - ~H""" - -
-
- -

- Livebook Teams will amplify Livebook with features designed for teams and businesses. -

-
-

- It will allow you to share notebooks, manage secrets, and deploy Livebook apps within your organization. -

-

- The product is still in development. We want to get feedback from beta users and understand - their use cases before the public launch. -

-

- - Learn more about Livebook Teams - - and join the beta program. -

-

- - The Livebook crew -

-
-
- """ - end - def render(assigns) do ~H""" + + Beware! + You are running Livebook in development but this page communicates with production servers. + +