Leon4gr45 commited on
Commit
e0cb86e
·
verified ·
1 Parent(s): 649ce15

Deploy Plausible Analytics with local DB files (part 2)

Browse files
Files changed (1) hide show
  1. config/runtime.exs +2 -2
config/runtime.exs CHANGED
@@ -522,13 +522,13 @@ end
522
 
523
  db_cacertfile = get_var_from_path_or_env(config_dir, "DATABASE_CACERTFILE")
524
  %URI{host: db_host} = db_uri = URI.parse(db_url)
525
- db_socket_dir? = String.starts_with?(db_host, "%2F") or db_host == ""
526
 
527
  if db_socket_dir? do
528
  [database] = String.split(db_uri.path, "/", trim: true)
529
 
530
  socket_dir =
531
- if db_host == "" do
532
  db_host = (db_uri.query || "") |> URI.decode_query() |> Map.get("host")
533
  db_host || raise ArgumentError, "DATABASE_URL=#{db_url} doesn't include host info"
534
  else
 
522
 
523
  db_cacertfile = get_var_from_path_or_env(config_dir, "DATABASE_CACERTFILE")
524
  %URI{host: db_host} = db_uri = URI.parse(db_url)
525
+ db_socket_dir? = is_nil(db_host) or db_host == "" or String.starts_with?(db_host, "%2F")
526
 
527
  if db_socket_dir? do
528
  [database] = String.split(db_uri.path, "/", trim: true)
529
 
530
  socket_dir =
531
+ if db_host == "" or is_nil(db_host) do
532
  db_host = (db_uri.query || "") |> URI.decode_query() |> Map.get("host")
533
  db_host || raise ArgumentError, "DATABASE_URL=#{db_url} doesn't include host info"
534
  else