mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-04 20:14:57 +08:00
Remove create hub feature flag, warn if using production servers in dev
This commit is contained in:
parent
aa0c70fc05
commit
8041d8ee9a
6 changed files with 22 additions and 54 deletions
|
@ -16,11 +16,10 @@ config :livebook, LivebookWeb.Endpoint,
|
||||||
npm: ["run", "watch", cd: Path.expand("../assets", __DIR__)]
|
npm: ["run", "watch", cd: Path.expand("../assets", __DIR__)]
|
||||||
]
|
]
|
||||||
|
|
||||||
config :livebook, :iframe_port, 4001
|
config :livebook,
|
||||||
config :livebook, :shutdown_callback, {System, :stop, []}
|
iframe_port: 4001,
|
||||||
|
shutdown_callback: {System, :stop, []},
|
||||||
# Feature flags
|
warn_on_live_teams_server: true
|
||||||
config :livebook, :feature_flags, create_hub: true
|
|
||||||
|
|
||||||
# ## SSL Support
|
# ## SSL Support
|
||||||
#
|
#
|
||||||
|
|
|
@ -6,13 +6,14 @@ config :livebook, LivebookWeb.Endpoint,
|
||||||
http: [port: 4002],
|
http: [port: 4002],
|
||||||
server: false
|
server: false
|
||||||
|
|
||||||
config :livebook, :iframe_port, 4003
|
|
||||||
|
|
||||||
# Print only warnings and errors during test
|
# Print only warnings and errors during test
|
||||||
config :logger, level: :warning
|
config :logger, level: :warning
|
||||||
|
|
||||||
# Disable authentication mode during test
|
# 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")
|
data_path = Path.expand("tmp/livebook_data/test")
|
||||||
|
|
||||||
|
@ -23,14 +24,8 @@ end
|
||||||
|
|
||||||
config :livebook, :data_path, data_path
|
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,
|
# 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
|
# see https://github.com/livebook-dev/livebook/pull/173#issuecomment-819468549
|
||||||
if System.get_env("CI") == "true" do
|
if System.get_env("CI") == "true" do
|
||||||
config :livebook, :node, {:longnames, :"livebook@127.0.0.1"}
|
config :livebook, :node, {:longnames, :"livebook@127.0.0.1"}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Teams
|
|
||||||
config :livebook, check_completion_data_interval: 300
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ defmodule Livebook do
|
||||||
end
|
end
|
||||||
|
|
||||||
if url = Livebook.Config.teams_url!("LIVEBOOK_TEAMS_URL") do
|
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
|
end
|
||||||
|
|
||||||
if Livebook.Config.boolean!("LIVEBOOK_SHUTDOWN_ENABLED", false) do
|
if Livebook.Config.boolean!("LIVEBOOK_SHUTDOWN_ENABLED", false) do
|
||||||
|
|
|
@ -312,6 +312,13 @@ defmodule Livebook.Config do
|
||||||
Application.fetch_env!(:livebook, :random_boot_id)
|
Application.fetch_env!(:livebook, :random_boot_id)
|
||||||
end
|
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
|
## Parsing
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
|
|
@ -49,7 +49,7 @@ defmodule Livebook.Teams.Org do
|
||||||
|> cast(attrs, @fields)
|
|> cast(attrs, @fields)
|
||||||
|> validate_required(@required_fields)
|
|> validate_required(@required_fields)
|
||||||
|> validate_format(:name, ~r/^[a-z0-9][a-z0-9\-]*$/,
|
|> 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
|
end
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,10 @@ defmodule LivebookWeb.Hub.NewLive do
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def mount(_params, _session, socket) do
|
def mount(_params, _session, socket) do
|
||||||
enabled? = Livebook.Config.feature_flag_enabled?(:create_hub)
|
|
||||||
|
|
||||||
socket =
|
socket =
|
||||||
assign(socket,
|
assign(socket,
|
||||||
selected_option: "new-org",
|
selected_option: "new-org",
|
||||||
page_title: "Hub - Livebook",
|
page_title: "Hub - Livebook",
|
||||||
enabled?: enabled?,
|
|
||||||
requested_code: false,
|
requested_code: false,
|
||||||
org: nil,
|
org: nil,
|
||||||
verification_uri: nil,
|
verification_uri: nil,
|
||||||
|
@ -36,44 +33,14 @@ defmodule LivebookWeb.Hub.NewLive do
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def render(%{enabled?: false} = assigns) do
|
|
||||||
~H"""
|
|
||||||
<LayoutHelpers.layout current_page="/hub" current_user={@current_user} saved_hubs={@saved_hubs}>
|
|
||||||
<div class="p-4 md:px-12 md:py-7 max-w-screen-md mx-auto space-y-6">
|
|
||||||
<div>
|
|
||||||
<LayoutHelpers.title text="Livebook Teams is coming soon!" />
|
|
||||||
<p class="mt-4 text-gray-700">
|
|
||||||
Livebook Teams will amplify Livebook with features designed for teams and businesses.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<p class="text-gray-700">
|
|
||||||
It will allow you to share notebooks, manage secrets, and deploy Livebook apps within your organization.
|
|
||||||
</p>
|
|
||||||
<p class="text-gray-700">
|
|
||||||
The product is still in development. We want to get feedback from beta users and understand
|
|
||||||
their use cases before the public launch.
|
|
||||||
</p>
|
|
||||||
<p class="text-gray-700">
|
|
||||||
<a
|
|
||||||
class="font-medium underline text-gray-900 hover:no-underline"
|
|
||||||
href="https://livebook.dev/teams?ref=LivebookApp"
|
|
||||||
target="_blank"
|
|
||||||
>
|
|
||||||
Learn more about Livebook Teams
|
|
||||||
</a>
|
|
||||||
and join the beta program.
|
|
||||||
</p>
|
|
||||||
<p class="text-gray-700">
|
|
||||||
- The Livebook crew
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</LayoutHelpers.layout>
|
|
||||||
"""
|
|
||||||
end
|
|
||||||
|
|
||||||
def render(assigns) do
|
def render(assigns) do
|
||||||
~H"""
|
~H"""
|
||||||
<LayoutHelpers.layout current_page="/hub" current_user={@current_user} saved_hubs={@saved_hubs}>
|
<LayoutHelpers.layout current_page="/hub" current_user={@current_user} saved_hubs={@saved_hubs}>
|
||||||
|
<LayoutHelpers.topbar :if={Livebook.Config.warn_on_live_teams_server?()} variant={:warning}>
|
||||||
|
<strong>Beware!</strong>
|
||||||
|
You are running Livebook in development but this page communicates with production servers.
|
||||||
|
</LayoutHelpers.topbar>
|
||||||
|
|
||||||
<div class="flex flex-col p-4 md:px-12 md:py-7 max-w-screen-md mx-auto space-y-8">
|
<div class="flex flex-col p-4 md:px-12 md:py-7 max-w-screen-md mx-auto space-y-8">
|
||||||
<div>
|
<div>
|
||||||
<LayoutHelpers.title text="Add Hub" />
|
<LayoutHelpers.title text="Add Hub" />
|
||||||
|
|
Loading…
Add table
Reference in a new issue