mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-04 20:14:57 +08:00
Remove compile-time dependency on Livebook.FileSystem.S3
This commit is contained in:
parent
45c94789db
commit
0601733f16
1 changed files with 8 additions and 5 deletions
|
@ -85,12 +85,15 @@ defmodule Livebook.FileSystem.S3 do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@personal_id Livebook.Hubs.Personal.id()
|
|
||||||
|
|
||||||
def id(_, nil), do: nil
|
def id(_, nil), do: nil
|
||||||
def id(nil, bucket_url), do: hashed_id(bucket_url)
|
|
||||||
def id(@personal_id, bucket_url), do: hashed_id(bucket_url)
|
def id(hub_id, bucket_url) do
|
||||||
def id(hub_id, bucket_url), do: "#{hub_id}-#{hashed_id(bucket_url)}"
|
if hub_id == nil or hub_id == Livebook.Hubs.Personal.id() do
|
||||||
|
hashed_id(bucket_url)
|
||||||
|
else
|
||||||
|
"#{hub_id}-#{hashed_id(bucket_url)}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
defp hashed_id(bucket_url) do
|
defp hashed_id(bucket_url) do
|
||||||
hash = :crypto.hash(:sha256, bucket_url)
|
hash = :crypto.hash(:sha256, bucket_url)
|
||||||
|
|
Loading…
Add table
Reference in a new issue