mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-10 21:46:46 +08:00
Create home and data_path directories if missing (#1003)
* Create home and data_path directories if missing * Update lib/livebook/config.ex * Configure project-local data path for dev and test env * Expand dev/test paths in compile config Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
This commit is contained in:
parent
8836d6908c
commit
2c271e2efb
3 changed files with 12 additions and 2 deletions
|
@ -71,3 +71,5 @@ config :phoenix, :plug_init_mode, :runtime
|
||||||
|
|
||||||
# Disable authentication mode during dev
|
# Disable authentication mode during dev
|
||||||
config :livebook, :authentication_mode, :disabled
|
config :livebook, :authentication_mode, :disabled
|
||||||
|
|
||||||
|
config :livebook, :data_path, Path.expand("tmp/livebook_data/dev")
|
||||||
|
|
|
@ -14,6 +14,8 @@ config :logger, level: :warn
|
||||||
# Disable authentication mode during test
|
# Disable authentication mode during test
|
||||||
config :livebook, :authentication_mode, :disabled
|
config :livebook, :authentication_mode, :disabled
|
||||||
|
|
||||||
|
config :livebook, :data_path, Path.expand("tmp/livebook_data/test")
|
||||||
|
|
||||||
# Use the embedded runtime in tests by default, so they
|
# Use the embedded runtime in tests by default, so they
|
||||||
# are cheaper to run. Other runtimes can be tested by starting
|
# are cheaper to run. Other runtimes can be tested by starting
|
||||||
# and setting them explicitly
|
# and setting them explicitly
|
||||||
|
|
|
@ -6,7 +6,8 @@ defmodule Livebook.Application do
|
||||||
use Application
|
use Application
|
||||||
|
|
||||||
def start(_type, _args) do
|
def start(_type, _args) do
|
||||||
ensure_local_filesystem!()
|
ensure_directories!()
|
||||||
|
set_local_filesystem!()
|
||||||
ensure_distribution!()
|
ensure_distribution!()
|
||||||
validate_hostname_resolution!()
|
validate_hostname_resolution!()
|
||||||
set_cookie()
|
set_cookie()
|
||||||
|
@ -55,7 +56,12 @@ defmodule Livebook.Application do
|
||||||
:ok
|
:ok
|
||||||
end
|
end
|
||||||
|
|
||||||
defp ensure_local_filesystem!() do
|
defp ensure_directories!() do
|
||||||
|
File.mkdir_p!(Livebook.Config.home())
|
||||||
|
File.mkdir_p!(Livebook.Config.data_path())
|
||||||
|
end
|
||||||
|
|
||||||
|
defp set_local_filesystem!() do
|
||||||
home =
|
home =
|
||||||
Livebook.Config.home()
|
Livebook.Config.home()
|
||||||
|> Livebook.FileSystem.Utils.ensure_dir_path()
|
|> Livebook.FileSystem.Utils.ensure_dir_path()
|
||||||
|
|
Loading…
Add table
Reference in a new issue