mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-09-20 10:05:57 +08:00
Do not stop booting if apps path is unavailable (#1812)
This commit is contained in:
parent
2e51cb82f6
commit
4b8834c599
|
@ -152,7 +152,7 @@ defmodule Livebook do
|
|||
config :livebook, :data_path, data_path
|
||||
end
|
||||
|
||||
if apps_path = Livebook.Config.readable_dir!("LIVEBOOK_APPS_PATH") do
|
||||
if apps_path = System.get_env("LIVEBOOK_APPS_PATH") do
|
||||
config :livebook, :apps_path, apps_path
|
||||
end
|
||||
|
||||
|
|
|
@ -107,6 +107,10 @@ defmodule Livebook.Apps do
|
|||
pattern = Path.join([path, "**", "*.livemd"])
|
||||
paths = Path.wildcard(pattern)
|
||||
|
||||
if paths == [] do
|
||||
Logger.warning("No .livemd files were found for deployment at #{path}")
|
||||
end
|
||||
|
||||
for path <- paths do
|
||||
markdown = File.read!(path)
|
||||
{notebook, warnings} = Livebook.LiveMarkdown.notebook_from_livemd(markdown)
|
||||
|
|
|
@ -262,33 +262,6 @@ defmodule Livebook.Config do
|
|||
end
|
||||
end
|
||||
|
||||
@doc """
|
||||
Parses and validates dir from env.
|
||||
"""
|
||||
def readable_dir!(env) do
|
||||
if dir = System.get_env(env) do
|
||||
readable_dir!(env, dir)
|
||||
end
|
||||
end
|
||||
|
||||
@doc """
|
||||
Validates `dir` within context.
|
||||
"""
|
||||
def readable_dir!(context, dir) do
|
||||
if readable_dir?(dir) do
|
||||
Path.expand(dir)
|
||||
else
|
||||
abort!("expected #{context} to be a readable directory: #{dir}")
|
||||
end
|
||||
end
|
||||
|
||||
defp readable_dir?(path) do
|
||||
case File.stat(path) do
|
||||
{:ok, %{type: :directory, access: access}} when access in [:read_write, :read] -> true
|
||||
_ -> false
|
||||
end
|
||||
end
|
||||
|
||||
@doc """
|
||||
Parses and validates the secret from env.
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue